Rails 3 DEPRECATIONS

Rails 3 DEPRECATIONS

I'm working my way through the transition from Rails 2 to Rails 3 and I came across the DEPRECATION warnings that we all will start seeing real soon. These are currently implemented as shortcuts to constants, but to bring your code up to date and eliminate deprecation concerns, they should all be converted.

The following are some of the most common (current way => new way):

RAILS_ROOT => Rails.root
RAILS_ENV => Rails.env
RAILS_DEFAULT_LOGGER => Rails.logger
RAILS_CACHE => Rails.cache

But what about the following?

RAILS_CACHE_ID
RAILS_ASSET_ID
RAILS_GEMS
RAILS_FRAMEWO?RK_ROOT
RAILS DEFAULT_DATABASE
RAILS_LOADED
RAILS_PKG_DESTINATION
RAILS_RELATIVE_URL_ROOT
RAILS_CONNECTION_ADAPTERS
RAILS_GEM_VERSION
RAILS_NOISE

Others that are not so directly related include:

RAILTIES_PATH
MERB_ENV
ROUTE_FILE
DEFAULT_BEHAVIORS

These constants were taken from Jamis Buck's "bucketwise" app that Jeremy McAnally uses as an example app in his well written Rails 3 Upgrade Handbook.

Is the idea that all of these constants will eventually be transitioned from shortcuts to the Rails 3 way (attributes?) or is there some special case for the current crop that make them special?

TIA for all replies.

-- Steve
s.d@comcast.net

Rails 3 DEPRECATIONS

I’m working my way through the transition from Rails 2 to Rails 3 and I came across the DEPRECATION warnings that we all will start seeing real soon. These are currently implemented as shortcuts to constants, but to bring your code up to date and eliminate deprecation concerns, they should all be converted.

The following are some of the most common (current way => new way):

RAILS_ROOT => Rails.root

RAILS_ENV => Rails.env

RAILS_DEFAULT_LOGGER => Rails.logger

RAILS_CACHE => Rails.cache

But what about the following?

RAILS_CACHE_ID

RAILS_ASSET_ID

RAILS_GEMS

RAILS_FRAMEWO?RK_ROOT

RAILS DEFAULT_DATABASE

RAILS_LOADED

RAILS_PKG_DESTINATION

RAILS_RELATIVE_URL_ROOT

RAILS_CONNECTION_ADAPTERS

RAILS_GEM_VERSION

RAILS_NOISE

Others that are not so directly related include:

RAILTIES_PATH

MERB_ENV

ROUTE_FILE

DEFAULT_BEHAVIORS

These constants were taken from Jamis Buck’s “bucketwise” app that Jeremy McAnally uses as an example app in his well written Rails 3 Upgrade Handbook.

Is the idea that all of these constants will eventually be transitioned from shortcuts to the Rails 3 way (attributes?) or is there some special case for the current crop that make them special?

TIA for all replies.

– Steve

s.d@comcast.net

I think you should post this across to RubyOnRails - Core ML.

Anuj