Upgrading to Rails 2.3
April 7, 2009
I spent most of today working on upgrading chi.mp to Rails 2.3. Upgrading required more than just simply freezing the new gems. Here are my notes so far:
application.rb becomes application_controller.rb
The source file application.rb becomes application_controller.rb.
uninitialized constant Rails::Plugin::OpenIdAuthentication
The OpenIdAuthentication plugin needed to be upgraded to the latest from github:
script/plugin install git://github.com/rails/open_id_authentication.git --force
undefined method `use_transactional_fixtures=’ for Test::Unit::TestCase:Class
Two problems occurred that caused this. First, the test/unit/test_helper.rb was opening up Test::Unit::TestCase to add additional items when it should be opening up ActiveSupport::TestCase. Additionally some of our tests were old and still extended from Test::Unit::TestCase instead of ActiveSupport::TestCase.
formatted_xxx_url
Formatted URLs should now use the normal xxx_url methods and just include :format => format in the options Hash.
has_many collections do not support .destroy(id)
They did, I’m certain (and I have code from 2.2.2 that works to prove it), but it no longer works. The easiest way to fix this is to replace collection.destroy(id) with collection.find(id).destroy. There is a lighthouse ticket for this as well if you’re interested in following along at home: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2306-associationcollections-destroy-method-is-not-compatible-with-old-version.
Enumerable.group_by now returns an OrderedHash
This one was maddening. First of all, as mentioned, Enumerable.group_by now returns an OrderedHash instead of an array of arrays. This taken by itself would have been ok, but our test expectation for this was showing the result as being a Hash where the keys were the arrays and the values were nil.
Local cache strategy freezes memcached objects
The local cache strategy now uses MemoryCache as a local storage mechanism in front of remote caches like memcached. Unfortunately the MemoryCache#write method freezes the objects and therefore if you try to modify them afterward an error is raised. The only way I’ve found to stop this for the moment is to change value.freeze to value in the MemoryStore.write method. This probably isn’t the best solution but it does the job.
That’s it so far, running locally. Next step is to test in an integrated environment.





April 7, 2009 at 5:00 pm
Thanks for the head’s up. Good luck with rest of the upgrade.
April 8, 2009 at 5:10 am
Very useful post – thanks.
April 14, 2009 at 11:37 pm
Thanks I was struggling with this after upgrading a site I work on. Fixed all my problems when I updated the plugin.
April 27, 2009 at 6:06 pm
Thank you so much for the tip on MemoryStore.write.
July 30, 2009 at 8:02 am
Thanks for this!