Rails 3 has landed! 9 Sep 10
After two years of hard work, the third generation of Rails is ready for the big time! Rails 3 brings about some major changes to make things all together “better, faster, cleaner, and more beautiful” and solve some of the common issues seen with Rails 2. Some of the major highlights include
Improved router syntax for Action Controller
The router syntax in Rails 3 has been completely revamped to build on the work from Rails 2 and provide a more elegant and flexible way to provide completely RESTful access for controllers. To get started see the new routing guide.
Brand new Action Mailer
Action Mailer was previously a bit of a hybrid, part controller, part model. Rails 3 sees Action Mailer completely rewritten purely as a controller, it now behaves much more like Action Controller. The new Action Mailer guide describes how to get going.
New query engine for Active Record
Active Record has adopted a new query engine to make complex queries more consistent and manageable. Execution of queries is now delayed until actually required and not when defined. For an introduction to the new query engine check out the new new Active Record guide.
Traditionally, managing the dependencies for your Rails app deployment can be a bit of a nightmare. While Capistrano, Rake and other partial solutions make automating things easier, they’re often not elegant or simple. Bundler provides a complete solution to managing gems, libraries, frameworks and plugins that your app depends on. The latest release of the Brightbox deployment gem offers full support for Bundler.
Other improvements include built in XSS protection, an official plugins API, Agnosticism with plugins, Active Model callbacks & validations, better handling of character encoding and many more. For a more comprehensive list of changes see the release notes.
Rails 3 on your Brightboxes
Getting up and running with Rails 3 on your Brightboxes should be as simple as you’re used to with your existing Rails 2 apps.
Rails 3 requires Ruby 1.8.7 or higher, Ruby 1.8.6 is no longer supported. If you’re using Hardy based Brightboxes you’ll need to upgrade the standard Ruby Enterprise Edition package, Lucid based Brightboxes include 1.8.7 by default. Ruby 1.9.2 is also supported, though we don’t have packages for it just yet.
Full support for Rails 3 deployment was added to the Brightbox deployment gem in version 2.3.7, so if you’re using an older version you’ll need to update. Don’t forget to update the brightbox-server-tools on your boxes too! The gem now has full bundler support for managing gem dependencies so if you’re using bundler you no longer need to define gems in your deployment recipe. Bundler is now our recommended solution for handling dependencies.
You’ll also need RubyGems 1.3.7 or newer. New Brightboxes include our 1.3.7 rubygems package for Ubuntu, if you’re running an older version you can upgrade like so
sudo apt-get update sudo apt-get install rubygems
We’d also recommend running your app with the latest version of Phusion Passenger, especially if you plan on running Rails 2 and 3 side-by-side.
Installing Rails 3 is as simple as
gem install rails --version 3.0.0
You can deploy your Rails 3 apps using the Brightbox gem just like you’re used to. Make sure you’re using the latest release of the gem which contains some new features to improve Rails 3 support.
For more information on using Rails 3 see the newly updated official documentation. For help with running Rails 3 on your Brightbox, including information on running Rails 2 & 3 side-by-side see our Rails 3 wiki page.