Here is a summary of a few of the problems I encountered while trying to upgrade an app from rails 2.1 to rails 2.2.2
Getting my dev code to run
First, to update the rails code:
> rake rails:freeze:gems
The first time I tried to run the app I got this error:
vendor/rails/activesupport/lib/active_support/dependencies.rb:445:in `load_missing_constant': uninitialized constant Inflector (NameError)
Accessing the inflector changes, so as
described here you need update APP/config/initializers/inflector.rb so it looks like this:
ActiveSupport::Inflector.inflections do |inflect|
...
end
In my case, I was also using the ActiveMerchant plugin which needed updating for the same reason
script/plugin install git://github.com/Shopify/active_merchant.git --force
According to gusg.us, HAML needs to be at 2.0.4. I didn’t see any problems in my testing but I didn’t want to try my luck so I updated HAML too.
sudo gem update haml
update my environment.rb gem requirement
config.gem "haml", :version => "2.0.6"
Then run
rake gems:unpack:dependencies
Production
While deploying to a staging server I got this error:
initializer.rb:514:in `send': undefined method `cache_template_loading=' for ActionView::Base:Class (NoMethodError)
As described here, to fix this, just update your APP/config/environments/production.rb (and staging.rb) file by removing the following:
config.action_view.cache_template_loading
Overall, it wasn’t too painful an upgrade…
I didn’t run rake rails:update. That may have fixed some of these things on it’s own, but my understanding was that that wasn’t needed anymore…