In my previous blog Upgrading Rails from 3.0 to 3.1, I explained you how we can upgrade a rails application from 3.0 to 3.1. In this I am going to show you, what changes are required to update an application from 3.1 to the latest of 3.2 rails version.
1) The first thing needed is to update the rails version in your Gemfile to this:
gem 'rails', '3.2.21'
2) Again changes in asset groups are needed:
group :assets do
gem 'sass-rails', '~> 3.2.6'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '>= 1.0.3'
end
3) Now to update everything, we need to run the bundle command
> bundle update
4) Now there are few configuration settings needs to be added to update an application to 3.2, this is regarding the change of mass assignment in active records. So you need to add these line in config/environments/development.rb
# For raising an exception regarding the mass assignment errors
config.active_record.mass_assignment_sanitizer = :strict
# Logging queries plans, that takes more than this time to execute
config.active_record.auto_explain_threshold_in_seconds = 0.5
5) Now the mass_assignment_sanitizer needs to be added in test environment too config/environments/test.rb.
# For raising an exception regarding the mass assignment errors
config.active_record.mass_assignment_sanitizer = :strict
6) In rails 3.2 it is not necessary to remove the vendor/plugins but you should at it has been removed from the rails 4. So it is recommended that should remove them from vendors. Thus in that case you have 2 options: first you can extract them from vendor and add them to Gemfile or you can add them somewhere in the lib folder and use them using initializer
7) The last option is that the dependent restrict has been removed from belongs_to method, so from now on if you need to use :dependent => :destroy and return false after checking for existence of association.
Thus your application is now upgraded to rails 3.2.
Hope you liked reading this blog.
0 Comment(s)