With the latest stable release of rails out the door for about a month, we’ve had a chance to upgrade the bulk of the applications we maintain to 22.214.171.124. The rails 2.3 release notes were a HUGE help during this upgrade. Thanks to the Mike Gunderloy for compiling that document.
Here are some gotchas, aka issues, aka roadblocks to Strategic Enterprise Adoption that we discovered while upgrading some of them.
Problem: ‘const_missing’: uninitialized constant CGI::Session (NameError)
Solution: Hoptoad Notifier plugin needs to be updated.
ruby script/plugin install --force git://github.com/thoughtbot/hoptoad_notifier.git
Rename application controller
Problem: ‘loadmissingconstant’: uninitialized constant ApplicationController (NameError)
Solution: You need to rename application.rb to application_controller.rb
@request.cookies["name"] = CGI::Cookie.new("name", "value") sets the
cookie to [value] instead of value.
Solution: You no longer need to set the cookie to a
Just set it to the string directly:
@request.cookies["name"] = "value"
Problem: undefined method ‘usetransactionalfixtures=’ for Test::Unit::TestCase:Class (NoMethodError)
Solution: In your test/test_helper.rb file, you need to rename ‘Test::Unit::TestCase’ to ‘ActiveSupport::TestCase’ to set these options.
Problem: NoMethodError: undefined method ‘assert_recognizes’ for #RoutesTest:0×22058f8
Solution: Are you testing your routes in a unit test with a class of ActiveSupport::TestCase? The routing assertions are only included in ActionController::TestCase now, so change the test class to use that instead.
Count through associations
Problem: errors on a #count that goes through a namedscope on a hasmany
:through. This used to successfully proxy through and run a successful
COUNT query. Now there’s all
Solution: not sure yet, maybe use the file at the end of that ticket?
Problem: when you deploy to staging or production, you get an error about an undefined ‘reenable’ method on Rake::Task.
Solution: This method was introduced in rake 0.8.2, but not actually used by rails prior to the 2.3 release. You need to update rake to a version newer than 0.8.2 on your servers (0.8.4 is latest stable as of now).
Problem: When deploying you get an undefined method ‘ruby_version’ for Gem:Module error.
Solution: Upgrade rubygems to the latest stable version (1.3.1 at the time of this post).