Migrating Existing Applications to Rails 3.0

This week Rails 3.0 reached final. The are many interesting new features such as Active Record Query Interface and lots of improvements (Routing, Action Mailer, Gem dependencies with Bundler, XSS protection, configuration cleanup, etc.) in this major upgrade.

Like with any major platform upgrade, many developers will be confronted with the dilemma of either staying on the 2.x branch — which will eventually be obsolete — or put in a lot of effort to migrate an otherwise perfectly good working application.

To make matter worse, the entire Rails eco-system of gems and plugin is in the process of upgrading to take advantage of new functionality. So even if you don't think you need any of the new features, you better get on the three-oh bandwagon bullet train soon.

To ease the pain of migration, Jeremy McAnally created a very useful plugin. It analyzes your current Rails application and generates a pre-flight checklist, highlighting areas that use deprecated api and will likely cause problems with Rails 3.0. The plugin also create a Gemfile used by Bundler, extracting all the gems dependencies from environment.rb. Lastly, it will rejigger routes.rb to use the new routing syntax.

Jeremy also wrote an extensive guide book on migrating to Rails 3.0. Although it's a paid publication, it is very affordable, comprehensive and well written.

Pratik Naik has also a good post describing the changes in Active Record.

With those tools in hands we've migrated an existing Rails 2.3.8 application to 3.0 and got it to boot in a couple of hours.

Hope you'll hop on the train too.

Talk Back