---
title: Rails 2.3.2 upgrade gotchas
teaser: Known issues with upgrading to Rails version 2.3.2.
tags: web,rails
author: Matt Jankowski
published_on: 2009-04-15
---

With the [latest stable release of
rails](http://weblog.rubyonrails.org/2009/3/16/rails-2-3-templates-engines-rack-metal-much-more)
out the door for about a month, we've had a chance to upgrade the bulk of the
applications we maintain to 2.3.2.1.  The [rails 2.3 release
notes](http://guides.rubyonrails.org/2_3_release_notes.html) were a HUGE help
during this upgrade.  Thanks to the Mike Gunderloy for compiling that document.

![''](http://images.thoughtbot.com/ui/2009-4-15-dinosaur-images-040-resize.jpg.jpeg)

Here are some gotchas, aka issues, aka roadblocks to Strategic Enterprise
Adoption that we discovered while upgrading some of them.

## Upgrade Hoptoad

Problem: 'const_missing': uninitialized constant CGI::Session (NameError)

Solution: [Hoptoad Notifier](http://www.hoptoadapp.com) plugin needs to be
updated.

<kbd> ruby script/plugin install --force
git://github.com/thoughtbot/hoptoad_notifier.git </kbd>

## Rename application controller

Problem: You see `'load_missing_constant': uninitialized constant
ApplicationController (NameError)`.

Solution: You need to rename `application.rb` to `application_controller.rb`.

## CGI::Cookie

Problem: `@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 `CGI::Cookie` instance.
Just set it to the string directly: `@request.cookies["name"] = "value"`.

## Transactional Fixtures

Problem: You see an `undefined method 'use_transactional_fixtures=' 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.

## Routing tests

Problem: You see `NoMethodError: undefined method 'assert_recognizes' for
#<RoutesTest:0&#215;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 `named_scope` on a `has_many
:through`.  This used to successfully proxy through and run a successful `SQL
COUNT` query.  Now there's [all this].

Solution: not sure yet, maybe use the file at the end of that ticket?

## Upgrade rake

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).

## Upgrade rubygems

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).

[all this]:
http://rails.lighthouseapp.com/projects/8994/tickets/2189-count-breaks-sqlite-has_many-through-association-collection-with-named-scope#ticket-2189-10
