At the Forge - Ruby on Rails 3

What's new in Ruby on Rails 3, and what has stayed the same? Reuven explores the latest version of this framework and what it means for you.
Should You Upgrade?

After describing Rails 3 so enthusiastically, you might expect that I'll tell you to go out and upgrade whatever Rails 2 applications you might have written immediately. And, indeed, if the application is simple and small, such an upgrade is not a bad idea.

But, if you're like me and work with some large, complex applications, switching is not likely to be a quick or easy process. A large number of queries will need to be rewritten to use Active Relation. The routing table will need to change, the Gemfile will need to be rewritten, and you'll have to double-check your helpers for XSS attacks. This doesn't mean upgrading is a Herculean task, but it's not something to attempt in one evening.

The first thing I would suggest to anyone considering an upgrade is to ensure that your tests, and especially your integration tests, are in place, passing and providing you with adequate test coverage. Once you have such tests in place, you can start the upgrade process, checking at every stage to see what you might have broken.

A plugin called rails_upgrade is available; it provides a Rake task that looks through your code and configuration, tries to determine places where you might encounter problems and points them out to you. If you have good test coverage and run rails_upgrade, you're likely to know where potential problems lie and whether you've broken anything when you try to align your code with Rails 3.

Finally, upgrading to the latest version of Rails 2 (2.3.10, at the time of this writing) is a good way to prep for an upgrade to Rails 3. If you read through your logs, you'll find a number of deprecation warnings that are meant to nudge (push?) you in the direction of Rails 3 compatibility. Even if you don't plan to upgrade right away, getting your code closer to Rails 3 standards won't be a bad thing.

Conclusion

Rails 3 is a terrific upgrade to an already great Web development framework. While it was under development, I followed the blog postings and explanations with some trepidation, wondering how different Rails 3 would be from previous versions. I needn't have worried. As Rails has improved my experience as a Web developer in many small ways, so too has Rails 3 improved on its predecessor with many small changes. I generally like these changes a great deal and believe this shows that Rails still has a lot going for it. Upgrading might be tricky in some cases, but it's worth working in that direction, even if it takes a while. The application's execution speed will improve as a result, but so will your development speed and the maintainability of your code.

Reuven M. Lerner is a longtime Web developer, architect and trainer. He is a PhD candidate in learning sciences at Northwestern University, researching the design and analysis of collaborative on-line communities. Reuven lives with his wife and three children in Modi'in, Israel.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState