Modified to use Rails 3.2