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)
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"
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…
Wow gross. I wish it weren’t so painful…
It wasn’t painless, but it was actually pretty easy. Only took about 40min….
Thanks Geoff. Due to your help I could quickly do the migration.
Ahh, those pesky plugins….
Thanks for reminding me.
Follow up:
Even though the migration worked with the above, my mysql broke.
If you have this issue, follow this thread, which did the trick for me:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/399a51529e9f75a1
You’ll need to do BOTH the mysql update as well as the name_tool thing….
Cheers!
[...] That’s it! It overall was a very easy upgrade that took much less time to test than my rails 2.1 to rails 2.2.2 upgrade. [...]
Thanks for the tip. It helped me to upgrade from Rails 2.1.0 to Rails 2.3.2 – it was pretty much same procedure.