Skip to content

migrating a rails app from 2.x to 3.0

I’m sitting here with @gavinstark at major coffee/sandwich chain playing with rails 3.0 for the railsbridge bugmash weekend.

Here’s what I had to do to get the omnominator app migrated to 3.0. Some (most) steps taken from Yehuda Katz’s post.

Check out rails source:

git clone git://

Run rails update script

I forked a copy of the omninator code for this; from the root dir of the app:

 ruby /path/to/rails3/railties/bin/rails .

Note that I had to call that with ruby, as it wasn’t pre-set to be an executable ruby script.

I let that overwrite all the script/ files etc.

Note about config/environment

The config/environment.rb now basically just requires config/application.rb, and all the config statements in config/development.rb, etc are wrapped in an initializer block like:

 Myapp::Application.configure do
      config.cache_classes = false

So, do that for each of your env-specific config files, and (I think) move the config code from environment.rb to application.rb.


Gems are now handled in Gemfile, instead of using config.gem in environment.rb etc.

Update the gemfile

Again, from Yehuda’s post, copy this block to your new Gemfile:

 # Add to the top
 directory "/path/to/rails", :glob => "{*/,}*.gemspec"
 git "git://"
 git "git://"

and then from the root of the app run:

gem bundle

(note that you need to have the ‘bundler’ gem installed, so ‘sudo gem install bundler’ if you need to..)

I had to remove a couple of initializers:

  • Hoptoad notifier initializer fails, so I commented it out for now; I’ll update this post when I figure out the Hoptoad compatibility
  • new_rails_defaults, which was added in 2.x to ease migration, failed under 3.0; that makes sense ’cause it’s redundant now.

That was it. The omnominator is a one-controller basically two-view app, so I’m sure there are other upgrade issues for more complicated apps, but maybe this will get you started.