diff options
author | wycats <wycats@gmail.com> | 2010-06-29 12:18:17 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-06-29 12:20:15 -0700 |
commit | d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db (patch) | |
tree | 83eb729393ddffc4fb06f6c49c96c9bf758220e6 /railties | |
parent | 21957b72ea394c679d9b17e75b570cc99596322d (diff) | |
download | rails-d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db.tar.gz rails-d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db.tar.bz2 rails-d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db.zip |
Create a deprecation behavior that triggers a notification for deprecation notices, and make the behaviors independent of the environment names.
* In Rails 2.3 apps being upgraded, you will need to add the deprecation
configuration to each of your environments. Failing to do so will
result in the same behavior as Rails 2.3, but with an outputted warning
to provide information on how to set up the setting.
* New Rails 3 applications generate the setting
* The notification style will send deprecation notices using
ActiveSupport::Notifications. Third-party tools can listen in to
these notifications to provide a streamlined view of the
deprecation notices occurring in your app.
* The payload in the notification is the deprecation warning itself
as well as the callstack from the point that triggered the
notification.
Diffstat (limited to 'railties')
5 files changed, 12 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index f0e917dd96..99758dfcf7 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -16,4 +16,7 @@ # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log end diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index b9fb13b640..93407fa058 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -43,4 +43,7 @@ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notification end diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt index beb28e2229..26cdef071a 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt @@ -29,4 +29,7 @@ # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr end diff --git a/railties/test/application/url_generation_test.rb b/railties/test/application/url_generation_test.rb index 72cae23985..2b6ec26cd0 100644 --- a/railties/test/application/url_generation_test.rb +++ b/railties/test/application/url_generation_test.rb @@ -16,6 +16,7 @@ module ApplicationTests class MyApp < Rails::Application config.secret_token = "3b7cd727ee24e8444053437c36cc66c4" config.session_store :cookie_store, :key => "_myapp_session" + config.active_support.deprecation = :log end MyApp.initialize! diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index b46ac0efaf..390c0ab543 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -100,7 +100,7 @@ module TestHelpers end end - add_to_config 'config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"; config.session_store :cookie_store, :key => "_myapp_session"' + add_to_config 'config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"; config.session_store :cookie_store, :key => "_myapp_session"; config.active_support.deprecation = :log' end def make_basic_app @@ -110,6 +110,7 @@ module TestHelpers app = Class.new(Rails::Application) app.config.secret_token = "3b7cd727ee24e8444053437c36cc66c4" app.config.session_store :cookie_store, :key => "_myapp_session" + app.config.active_support.deprecation = :log yield app if block_given? app.initialize! |