Rails 3.2

Rails 3.2 is a much smaller update and upgrade process then the one from 3.0 to 3.1. The biggest item in 3.1 was the asset pipeline, which most people have already setup.

The main features in Rails 3.2 are the following:

  • faster development environment. This is a really nice improvement and makes the development process much faster.

  • new routing engine, which doesn't have a big impact from the development point of view, but makes the routing faster, especially with pages containing many links.

  • automatic query explains, which makes it easier to find slow queries in an application. It can be used as an active record relation specifically or it is run automatically if the query is slower then a threshold value.

  • tagged logging, which makes it easier to see where a specific log entry is coming from.

Upgrade to 3.2

As mentioned before, upgrading to Rails 3.2 is very easy. You basically only need to change the rails gem version in the Gemfile:

gem 'rails', '3.1.3'

to

gem 'rails', '3.2.1'

and then do

$ bundle update

You can also set the versions for the asset related gems like sass-rails, coffee-rails and uglifier to the new versions, but they will be upgraded automatically by just upgrading rails. Just make sure you haven't specified the older version for them either

There are some new configuration options as described by Rails Release Notes.

The following options, while not mandatory, are good to add to the development environment configuration file config/environments/development.rb

### This sets the threshold for the auto explain feature
config.active_record.auto_explain_threshold_in_seconds = 0.5

### Set this if you want an exception for mass_assignment fails
config.active_record.mass_assignment_sanitizer = :strict

Plugins

Rails 3.2 displays a warning for all plugins located in the /vendor/plugins directory if you have any. That can be the case if you started your application with Rails 2.3, although in that case you will have a lot of other upgrade tasks too. If you don't want to be spammed with warnings every time you start the application the plugins need to be moved to, for example /lib/plugin_name.

That's a short and simple explanation for upgrading a basic Rails app to 3.2. As always, when upgrading a bigger application be sure to run your tests, especially when also upgrading other gems.