Repairing Postgresql after upgrading to OSX 10.7 Lion

I recently upgraded to OSX 10.7, at which point my rails installation completely borked when trying to connect to the psql server. When I do it from the command line using psql -U postgres it works totally fine, but when I try to run the rails server or console with the same username and password, … Read more

execJs: ‘Could not find a JavaScript runtime’ but execjs AND therubyracer are in Gemfile

I’m getting this error: rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs, I have already spent more hours searching google then I am willing to admit. I believe this is an execJs bug. From all the posts, this is a very common issue with rails 3.1. A js runtime is now needed by … Read more

How to redirect to previous page in Ruby On Rails?

I have a page that lists all of the projects that has sortable headers and pagination. path: /projects?order=asc&page=3&sort=code I choose to edit one of the projects path: projects/436/edit When I click save on that page, it calls the projects controller / update method. After I update the code I want to redirect to the path … 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