Updating a real world application to Rails 3

Posted by Michael Reinsch on 2010-12-03

We have just finished updating one of our bigger projects from Rails 2.3.8 to 3.0.3 and wanted to share our experience.

The update process:

For the update we performed the following tasks:

  • basic Rails 3 framework update, including new routes and switch to bundler
  • update the gems and plugins, replace some gems / plugins with others or with custom code (see below)
  • resolve Rails and shoulda deprecations
  • adapt to Rails 3 new escaping behavior
  • port all mailers to the new ActionMailer API

For the update process itself, we followed the various advise out there.

Finding replacements for the gems and plugins we used wasn't always straight forward.  The replacements we had to do:

Some numbers:

To give you an impression of the size of the application, here are the sloccount numbers:

  • test: 4047 sloc
  • app: 2497 sloc
  • vendor: 606 sloc
  • config: 332 sloc
  • lib: 188 sloc

Change statistics (taken from git, comparing before starting the upgrade with upgrade finished):

  • all directories excluding vendor:
    268 of 698 files changed with 2191 insertions, 1886 deletions
  • app, config, lib, test only:
    260 of 263 files changes with 1957 insertions, 1801 deletions

As you can see, changes were needed to nearly every file in app, config. The main reason we also had to change so many test cases were the deprecations in shoulda.

In total we spent 51 hours on the upgrade, plus 10 hours debugging a very strange issue.

The basic update and getting our test cases running again took us around 2 days. Another 5 days we then spent mainly on:

  • Resolving deprecations and minor issues which were caused by changed behavior in new Rails or gems.
  • Updating our own plugins and gems. This was rather challenging because for some parts of Rails the documentation is still lacking or outdated.
  • The new escaping behavior wasn't caught by our test cases. So manual testing to find any escaped HTML chunks in was required.
  • Locale in URL handling: The new router still isn't flexible enough and we couldn't DRY this up completely. For simpler sites routing-filter works nicely though.

All in all, the update took a bit longer than we expected (which was about a week). We attribute this to the amount of detail that needed to be addressed.

About the author

Michael

Michael is a technology enthusiast with background in software engineering and computer science. Originally from Germany, he came to Japan in 2004 to experience Japanese student life. He extended his stay and worked at a Japanese mobile web startup, using Ruby as the main programming language. In December of 2008 he became a founding partner of mobalean. Then, in July of 2013 he moved to work on Doorkeeper as co-founder of Doorkeeper KK.

Skype Linkedin github Plancast
Email Skype Google Twitter Facebook Linkedin github Plancast
comments powered by Disqus