For simple Ruby on Rails apps that use very few plugins, upgrading may be as simple as:
rake rails:updateFor everyone else, there may be some work to do.
Step 1: Upgrade incompatible plugins and gems
Internally, Rails has undergone many changes which broken compatibility with a variety of gems and plugins. Luckily most of them have been updated to be compatible with Rails 2.1
I had to upgrade the following:
active_scaffold, flex_image, haml, has_many_polymorphs, will_paginate
If you suspect that one of the plugins you use is causing problems, check for a newer version. There's a good chance that it's been upgraded to be Rails 2.1 compatible.
Step 2: Remove unneeded plugins
has_finder's functionality has been included in Rails 2.1 as 'named_scope'. The plugin will interfere with this functionality and crash your app. Simply remove the plugin, and change your code from 'has_finder' to 'named_scope'
Step 3: Remove hacks
Remember the garbage collection hacks? Get rid of them! The internals have changed, and at the very least they'll break ActiveRecord.
Step 4: Fix all of the code that you broke by upgrading your plugins.
Some plugins such as FlexImage have totally changed their api to be more 'rails compatible'. In this case you'll have to make some changes to comply with the new API interface
Step 5: Be explicit when rendering partials in xhr responses
Often an xhr response will do something like:
page.update_html 'some_element', render(:partial =>
'some_controller/some_thing')This may break in Rails 2.1, with an error message:
Missing template
some_controller/_some_thing.js.erbIf you want to render a partial html template in a rjs template, you must specify the file extension.
page.update_html 'some_element', render(:partial =>
'some_controller/some_thing.html.erb')
Post Comments
wmoxam said – Thu, 26 Jun 2008 12:42:21 -0000 ( Flag Edit Link )
Thanks for the clarification. Also, I believe that the ‘old way’ works in Edge rails. I could be wrong though.