Why Upgrade to Rails 3? Why Upgrade to Rails 3?

September 26, 2012   |   Tech
Agile League

If your Rails application is more than a couple years old, then there’s a good chance it’s still using Rails 2. A Rails 2 application will continue to run as it always has, but it could be time to consider a technology update to Rails 3 if you plan to continue to maintain and enhance the application. Here’s some reasons it could help:
Using the latest and greatest open-source libraries (gems)
Rails applications use gems that let the developer rapidly incorporate some kind of standard behavior, such as user authentication or Facebook integration. The huge variety of free gems is one of the great advantages of building an application in Rails in the first place. Many of these gems only support Rails 3, or their Rails 2.3 support is relegated to old versions of the gem. Upgrading your application to Rails 3 ensures you can use the latest and greatest versions of these libraries.
Developer knowledge and documentation
Any new Rails application being built in the last couple years would have started on Rails 3. As more developers deal only with the new version of the framework, it’s more and more difficult to remember the old way of doing things. Newer Rails developers might not even be familiar with old versions of Rails. Documentation is likewise easiest to find for more recent versions of Rails, which translates to faster development.
Security and features
As Rails matures, it improves, and its security improves. As of now, major security patches are still being made available for Rails 2.3, but the Rails team can’t support old versions indefinitely. And in general, Rails is adding great new features and improvements that your application can likely benefit from, either directly or through increased developer productivity. For example, Rails 3.1 introduced HTTP Streaming and the Asset Pipeline; and Rails 3.2 introduced big performance improvements in development mode.
It won’t get any easier
Waiting for the next version of Rails to come out before upgrading doesn’t mean an easier migration path, unfortunately. A Rails migration needs to be done in incremental steps for each point release. That means if your application is on Rails 2.3.8, it first has to be upgraded to the latest 2.3, then to 3.0, then 3.1, and finally 3.2. Upgrading to the next version of Rails will undoubtably still require progression through these steps before moving to the next version.
If you’re not upgrading yet…
If your application requires little maintenance, there are a few things you can do that don’t require a full Rails 3 upgrade, and will help move things along when you do decide to upgrade:

Upgrade to the latest release of Rails 2.3. This will keep you up to date with important security patches.

Start using Bundler. Bundler makes the management of gems in your application so much easier, and is pretty much the first step in a Rails 3 migration. The good news is that it also works just fine with Rails 2.3.

Add more automated testing. A better test suite is always beneficial, especially when doing an upgrade.

In Conclusion
Upgrading to Rails 3 can take 2 – 4 weeks, but at some point it makes sense to go ahead and make the transition to take advantage of future savings. A great time to do it would be before embarking on any major changes to your application that could dig you deeper into usage of outdated gems and techniques that would just need to be upgraded later. The investment will definitely pay off over time!