Marino Software - Easy to use web applications and websites

Upgrading to Rails 2

Posted by Keith Davey on February 18, 2008 at 08:45 PM

I have held off using Rails 2 on our existing apps for a while now and I decided it was time to give it a try. We have a number of apps running on various releases of rails 1.2 but I always figured it would be too much work to upgrade them. However its turns out to be pretty easy.

First off I ran:

rake rails:freeze:edge TAG=rel_2-0-2

The funny thing is that you have to run this twice. The reasoning is that the first time you run it you are running your rake command from rails 1.2, which isn't aware of several new pieces of rails 2, in my case Active Resource.

So if you get this error:

..vendor/rails/railties/lib/initializer.rb:159:in
`require_frameworks': no such file to load—active_resource

All you need to do is run the rake command the second time.

The advantage of freezing is that you can easily unfreeze later if you run in to problems.

The next item that came up is that a session key needs to be set in the environment.rb file. This takes the form of:

config.action_controller.session = { :session_key => '_project_session', :secret => 'blahblahblahblahblahblahblahblah' }

where the blah blah bit is a genuine key.

Without this the rails 2 app doesn't want to start.

Once those two were resolved our apps started up fine. They still nag about a few things, mostly deprecated items in our code. The only other config item that we had change was that
in config/environment/development.rb the line

config.breakpoint_server = true

has no effect anymore and I just commented it out.

So all in all its pretty easy to upgrade, and although your milage may vary, I'd recommend giving it a shot.

Tags: rails
Hierarchy: previous, next

Comments

There are 0 comments on this post. Post yours →

Post a comment

Required fields in bold.