How to create a file in Ruby

I’m trying to create a new file and things don’t seem to be working as I expect them too. Here’s what I’ve tried: File.new “out.txt” File.open “out.txt” File.new “out.txt”,”w” File.open “out.txt”,”w” According to everything I’ve read online all of those should work but every single one of them gives me this: ERRNO::ENOENT: No such file … Read more

What is the right way to override a setter method in Ruby on Rails?

I am using Ruby on Rails 3.2.2 and I would like to know if the following is a “proper”https://stackoverflow.com/”correct”https://stackoverflow.com/”sure” way to override a setter method for a my class attribute. attr_accessible :attribute_name def attribute_name=(value) … # Some custom operation. self[:attribute_name] = value end The above code seems to work as expected. However, I would like … Read more

Uninstall all installed gems, in OSX?

There are instances where I would like to revert and uninstall all previous gem installations. For instance, I needed to assist a friend migrate their rails development machine to use RVM. As they had been previously using the system-wide gem, he was experiencing many headaches when working with multiple projects. Essentially, he was the poster-child … Read more