Archive for February 8th, 2007

Moving to Rails 1.2.2

Thursday, February 8th, 2007

Well today I have FINALLY moved all my three current Rails projects (the third one is still in development though) to Rails 1.2.2.

There were some quirks I had to resolve during the transition though.

First of all, I have installed the latest version of rails onto the server by typing:

gem install rails –include-dependencies

Then I have updated all of the gems to their latest versions:

gem update

Some changes had to be made to the source code of my Ruby apps:

  • @params and @headers are deprecated now, so I have renamed them to params and headers
  • in environment.rb I have replaced the old RAILS_GEM_VERSION = '1.6' to RAILS_GEM_VERSION = '1.2.2' unless defined? RAILS_GEM_VERSION
  • there was a problem links generated by image_tag / FlexImage's flex_image generated image formatting function not resolved by Rails routing because image_tag attached the ".png" extension (and Rails 1.2 has a stricter checking for filenames in routes, so /image/show/123 was resolved just fine, but /image/show/123.png was getting unknown_action , though it was not a problem with Rails 1.1.6). As a simple solution I have added the following to routes.rb :
    map.connect 'image/:action/:id.:ext', :controller => 'image'
  • I have removed "vendor/plugins/engines", "vendor/plugins/unicode_hacks" as they seem not to be compatible with Rails 1.2 (everything worked fine in development mode, but was giving errors in production)
  • as the last step, I ran "rake rails:update" to update JS libs and stuff to their latest version

Everything works fine nice, and feels a bit snappier even. Cool :)