Rails 2.3 Upgrade Notes

February 27, 2010

In Need of Love and Care

I have written a number of rails applications over the past few years. While new projects are using rails 2.3 I have a number of older applications which I should have upgraded before but havent. Anyway, here is some little notes to take into account when upgrading to rails 2.3. Then from here you are placed well for the upcoming release of rails 3.

  • to_param method issues (fixnum to string)
  • test_helper modifications – class name (ActiveSupport::TestCase and all unit tests need to extend this)
  • add include ActionController::TestProcess to test_helper.rb
  • to silence spec warnings for old unpacked gems – Rails::VendorGemSourceIndex.silence_spec_warnings = true
  • sessions
ActionController::Base.session = {
  :key => '_session_name',
  :secret => 'd00cda5710eab8sdfsdf6c5fe165780074fa5027f50168a0bd0ae2832c05bb4f804a07228b220b67e'
}

In an initializer instead of environment.rb (some plugins access the session in a different manner.)

  • Truncate format is deprecated, update to include :length hash key.
  • If you are defining constants in environment.rb, move them to an initializer to make them play better with tests.
  • To access session_id you first have to call the session. Also, the method of accessing the session id has changed.

The following 2 lines are required to get the session id.

session[:session_id]
id = request.session_options[:id]