Breakage and fixage in Rails 2.2

Finally our app is completely Rails 2.2 ready.Some quick notes on some issues and things that needed to be fixed:1. Default error messagesThis call is no good any more


Use this instead:


2. Use ActiveSupport::Inflector rather than InflectorThe warning tells you all you need to know:

DEPRECATION WARNING: Inflector is deprecated! Use ActiveSupport::Inflector instead.

3. Integration tests are broken if you are not using the cookie storeSee here for details.  If you are seeing “NoMethodError: You have a nil object when you didn’t expect it!” inexplicably from your integration tests, then this could be the issue.I ended up placing this in environments/test.rb, even though it should not be needed:

config.action_controller.session = { :session_key => "_myapp_session",   :secret => "some secret phrase of at least 30 characters" }

4. Use of string keys in assert_redirected_to in tests no longer worksConsider this code:

assert_redirected_to "host"=>"",   "action"=>"something", "controller"=>"hw"

It used to work, but in rails 2.2 it does not.  You need to use symbols for the keys, like this:

assert_redirected_to :host=>"",   :action=>"something", :controller=>"hw"

I think the change was made in this commit.5. Render_partial is goneIf you are still using render_partial in places, you should replace it with render :partial=>”partial_name”6. HAML is not yet compatible with Rails 2.2There is a problem in HAML that causes output from calls to content_tag (and other tag helpers) to be lost.  See this thread for details.If you use HAML I do not recommend upgrading to rails 2.2 until this issue has been sorted out.  However, it’ll probably be fixed in a day or two, and the thread I linked to contains details of the patch I used if you need to fix it before that.7. Components are deprecatedWe had to rewrite some old code that was using components.  It actually wasn’t too much effort in the end, and the resulting refactoring was an improvement anyway.–As ever our tests were extremely valuable during this process.  Once HAML is sorted out we will be upgrading our production server to Rails 2.2, so hopefully that will be in a day or so.