Appendix A. Migrating to Rails 1.2

This appendix lists features and changes between Rails 1.1.6 and Rails 1.2. Old (1.1.6) code will run under Rails 1.2, but you’ll get warnings for deprecated features. Support for deprecated features will be removed in the next major release of Rails (2.0). The quickest way to find out what needs updating is to run your Rails 1.1.6 application under Rails 1.2, and check your logs for deprecation warnings.

Action Controller

Table A-1. Deprecated controller instance variables
Rails 1.1.6Rails 1.2
@cookies cookies
@envenv
@flashflash
@headersheaders
@paramsparams
@requestrequest
@responseresponse
@sessionsession
Table A-2. Deprecated controller methods
Rails 1.1.6Rails 1.2
expire_matched_fragments expire_fragment
keep_flash flash.keep
parse_query_parameters parse_form_encoded_parameters
parse_request_parameters parse_form_encoded_parameters
redirect_to_path redirect_to( path )
redirect_to_url redirect_to( url )
render('#{options}') render :file => #{options}
url_for(:#{options}) Call url_for with a named route directly

Table A-3. Deprecated assertions
Rails 1.1.6Rails 1.2
assert_assigned_equal assert_equal(expected, @response.template.assigns[key.to_s])
assert_cookie_equalassert(@response.cookies.key?(key))
assert_flash_emptyassert(!@response.has_flash_with_contents?)
assert_flash_equalassert_equal(expected, @response.flash[key])
assert_flash_existsassert(@response.has_flash?)
assert_flash_hasassert(@response.has_flash_object?(key))
assert_flash_has_noassert(!@response.has_flash_object?(key)) ...

Get Rails Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.