Fixing Problems with the Rails 1.2.2 Upgrade
Posted by Vince Wadhwani on Feb 12, 2007
I recently upgraded my Ruby on Rails install to version 1.2.2 using the great sudo gem update command. All seemed to go fine with the upgrade bringing me to version 1.2.2 as expected, but afterwards I was having major problems with my existing applications. Worse still, even newly created rails applications were throwing out things like (NoMethodError) undefined method `refresh' for #
I ran into this problem on Mac OS X 10.4 (Tiger) but it should work for you on linux or BSD too given the way rails and gems are put together. First of all, thanks to Andrew O'Brien and Louis Scoras for helping me through this!
The first thing you'll need to do is update Ruby Gems. When you ran sudo gem update, it updated all your gems, including rails, but it did not upgrade the actual Gem software itself. Gems are now at 0.9.2! To do this simply type:
sudo gem install rubygems-update
The above command assumes you are using Mac OS X or a linux/BSD distribution with sudo installed. Otherwise type gem install rubygems-update as root.
Once you've done that you may still find you're seeing errors anytime to you try to update a gem. You'll have to erase your source-cache to resolve this. On OS X:
cd /usr/local/lib/ruby/gems/1.8/gems/
sudo rm -rf source-cache
sudo rm -rf ~/.gem/source-cache
With the two source-cache's out of the way (the first being an entire directory and the second just a file in your Users' .gem directory, it's now time to update your gems again. Hopefully this time you won't get any ugly errors.
sudo gem update
Tada! Go forth and conquer in Rails 1.2.2!
BTW - the source-cache directory is in /usr/lib/ruby/gems/1.8 in Ubuntu Dapper Drake
Update March 5, 2007: If for some reason upgrading your gems does not work (check with the gem -v command) with sudo gem install rubygems-update, go ahead and just reinstall the gems from scratch. See the article on Installing Ruby Rails on Edgy Eft for instructions!