Updating to rails 2.3.2

As Ruby on Rails 2.3.2 is out, I am updating WoW Gossips to use the brand new Rails version.

First thing, install the new version of rails :

gem install rails

This installs the new version of the Rails gem, with its dependancies (ActiveRecord, Active Support, …)

Next, you need to update config/environment.php and change the required version to 2.3.2 :

RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION

Once this is done, you need to run the upgrade script :

rake rails:update

Congratulations ! Your app is now updated to Rails 2.3. But there is still some work to do. I recommend you to read the release notes, which contains all informations you will need. Here are some of the changes i needed to do.

When I ran my test suite, I got this error :

./test/test_helper.rb:27: undefined method `use_transactional_fixtures=' for Test::Unit::TestCase:Class (NoMethodError)

This is because Test::Unit::TestCase switched to ActiveSupport::TestCase. You need to change this in test/test_helper.rb :

class ActiveSupport::TestCase # old : class Test::Unit::TestCase

I also got warnings like this in my tests :

.DEPRECATION WARNING: formatted_character_url() has been deprecated. Please pass format to the standard changes_character_url method instead

This is because formatted_ routes are no longer generated when using resources. If you have things like this :

link_to @character.name, formatted_character_url(@character, :atom)

You now need to use :

link_to @character.name, character_url(@character, :format => :atom)

I will update this entry if I find more thinks I needed to update, but it seems ok for me right now, based on my automated tests and some manual browsing.

Update : When I deployed the new Rails 2.3.2 version of WoW Gossips, I got this error :

$ ./script/about
/usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- application (MissingSourceFile)
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:158:in `require'
        from /home/wowgossips/production/releases/20090317132628/config/environments/production.rb:41:in `load_environment'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:592:in `call'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:592:in `after_initialize'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:591:in `each'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:591:in `after_initialize'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:177:in `process'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
        from /home/wowgossips/production/releases/20090317132628/config/environment.rb:13
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/about.rb:1
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/local/ruby-enterprise-1.8.6-20090113/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from ./script/about:4

This is due to the exception logger plugin. To protect the Exception page, you need to add some code to config/environments/production.rb. You need to change it to reflect the rename of app/controllers/application.rb to app/controllers/application_controller.rb :

config.after_initialize do
  require 'application' unless Object.const_defined?(:ApplicationController)
  LoggedExceptionsController.class_eval do
# ...

Must be :

config.after_initialize do
  require 'application_controller' unless Object.const_defined?(:ApplicationController)
  LoggedExceptionsController.class_eval do
# ...

It seems you also need Passenger 2.0.6 to handle the new name of the ApplicationController file. I recommend you the latest Passenger version (2.1.2) which works fine for me.

Tags , ,

Posted in | Posted on 16 Mar 2009 21:23by Renaud Chaput | 2 comments

Categories

Links

Projects

Syndicate

Archives

Tags

Copyright © Ruby, Rails and Sysadmin

Tech Blue designed by Hive Designs • Ported by Free WordPress Themes and Frédéric de Villamil Powered by Typo