At the Forge - Ruby on Rails 3
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.
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.
The home page for Ruby on Rails is rubyonrails.org. That site has pointers to downloads, documentation and many resources offered by the community.
One terrific community resource is the “Rails Guides” documentation, which can walk you through a large number of features in Rails. These guides are great reading for Rails developers, new and old alike. They are current for Rails 3 and often point to differences with Rails 2 for those planning to upgrade.
The weekly “Railscasts” screencast produced by Ryan Bates continues, as always, to be a source of knowledge and inspiration. A large number of Railscasts in 2010 were devoted to Rails 3 and to what it means to upgrade. I viewed these several times before working with Rails 3, and they made a big difference in my work.
The rails_upgrade plugin can be downloaded and installed from its GitHub home page at github.com/rails/rails_upgrade.
You can learn more about Bundler at gembundler.com. Yehuda Katz also has a blog posting about Bundler and what it means for Rails developers, at yehudakatz.com/2010/09/30/bundler-as-simple-as-what-you-did-before.
Finally, a few books about Rails 3 have started to emerge. The best-known book from the Pragmatic Programmers, Agile Web Development with Rails written by Sam Ruby, Dave Thomas and Rails creator David Hannemeier Hansson, remains a solid introduction to the framework. A less-dense introduction, Beginning Rails 3, published by Apress and written by Cloves Carneiro Jr. and Rida Al Barazi, probably is a good starting point for people new to Web development.
And, although it is not yet published at the time of this writing, Rails 3 in Action by Yehuda Katz and Ryan Bigg, published by Manning, has the look of a real winner. I particularly like the fact that it uses Cucumber and RSpec. It also mentions third-party gems and services that a production Rails application is likely to use, such as Git, Hoptoad and paperclip.
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.
|Take Control of Your PC with UEFI Secure Boot||Nov 30, 2015|
|Geek Hide-away in Guatemala - Stay for Free!||Nov 26, 2015|
|Microsoft and Linux: True Romance or Toxic Love?||Nov 25, 2015|
|Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.||Nov 24, 2015|
|Cipher Security: How to harden TLS and SSH||Nov 23, 2015|
|Web Stores Held Hostage||Nov 19, 2015|
- Take Control of Your PC with UEFI Secure Boot
- Cipher Security: How to harden TLS and SSH
- Microsoft and Linux: True Romance or Toxic Love?
- Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.
- Web Stores Held Hostage
- Firefox's New Feature for Tighter Security
- Geek Hide-away in Guatemala - Stay for Free!
- PuppetLabs Introduces Application Orchestration
- diff -u: What's New in Kernel Development
- IBM LinuxONE Provides New Options for Linux Deployment