views:

207

answers:

4

Where can one find a list of deprecated methods, APIs, etc, in order to upgrade from Rails 2.x to Rails 3?

A: 

I found it to be a great value to buy http://www.railsupgradehandbook.com/

DGM
+1  A: 

A good way of checking the specifics about an individual app would be to run the rails_upgrade plugin on it (you can find it at GitHub), it will output a list of deprecation notices and recommendations

Some useful info is also summarised in this blog post: http://www.simonecarletti.com/blog/2010/07/the-way-to-rails-3/

Additionally Railscasts has a bunch of movies on various changed aspects of the API. Go to Railscasts.com and browse the movies filed under the rails3 tag.

svilenv
I want something exhaustive.
Omar
+3  A: 

I don't think you'll find an exhaustive list of depreciations because it really depends on what version of rails you are upgrading from. For instance, Rails 2.3.9 (just released) added additional depreciations over the previous release.

The Rails Upgrade Handbook (as mentioned above) is a great tool and contains 12 pages of depreciation warnings and how to fix them. I don't think they'll be published here because you should just drop the $9 and download the pdf to get the list. The included tutorials and other information makes it well worth it. It was for me.

If you don't want to pay for good information then just run the rails_upgrade plugin for your specific application. More information on how the plugin is on the rails upgrade plugin github page.

Nate Bird
It's absolutely ridiculous to pay for such a usually-free-for-all information.
Omar
You should go through the rails source code and pull out all of the depreciations and post them on a blog so they can be free-for-all information.
Nate Bird
I definitely do that right now, thought there's a better way!
Omar
+5  A: 

The Rails 3 release notes have lots of good information:

Railties now deprecates:

  • RAILS_ROOT in favor of Rails.root,
  • RAILS_ENV in favor of Rails.env, and
  • RAILS_DEFAULT_LOGGER in favor of Rails.logger.

ActionController:

  • The cookie_verifier_secret has been deprecated and now instead it is assigned through Rails.application.config.cookie_secret and moved into its own file: config/initializers/cookie_verification_secret.rb.
  • filter_parameter_logging is deprecated in favor of config.filter_parameters << :password.

ActiveRecord

  • named_scope in an Active Record class is deprecated and has been renamed to just scope.
  • save(false) is deprecated, in favor of save(:validate => false).
  • model.errors.on is deprecated in favor of model.errors[]
  • ActiveRecord::Base.colorize_logging and config.active_record.colorize_logging are deprecated in favor of Rails::LogSubscriber.colorize_logging or config.colorize_logging

ActionMailer

  • :charset, :content_type, :mime_version, :implicit_parts_order are all deprecated in favor of ActionMailer.default :key => value style declarations.
  • Mailer dynamic create_method_name and deliver_method_name are deprecated, just call method_name which now returns a Mail::Message object.
  • ActionMailer.deliver(message) is deprecated, just call message.deliver.
  • template_root is deprecated, pass options to a render call inside a proc from the format.mime_type method inside the mail generation block
  • The body method to define instance variables is deprecated (body {:ivar => value}), just declare instance variables in the method directly and they will be available in the view.
  • Mailers being in app/models is deprecated, use app/mailers instead.
Paul Schreiber