aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-28 21:55:07 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-28 22:49:22 -0200
commitf862376d169acfe362552787c095ff4b93834f9c (patch)
treea9d92a6f70cb839bb875e9cc867ed8dec6b5944d
parentccecab3ba950a288b61a516bf9b6962e384aae0b (diff)
downloadrails-f862376d169acfe362552787c095ff4b93834f9c.tar.gz
rails-f862376d169acfe362552787c095ff4b93834f9c.tar.bz2
rails-f862376d169acfe362552787c095ff4b93834f9c.zip
Gracefully handle upgrading apps with observers
Rather than just raising a NoMethodError when copying the config, this commit adds a warning message until either the rails-observers gem is installed or the relevant config options are removed.
-rw-r--r--activerecord/lib/active_record/railtie.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index 624d2784e8..c3f13b2dac 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -115,6 +115,18 @@ module ActiveRecord
See http://edgeguides.rubyonrails.org/security.html#mass-assignment for more information
EOF
end
+
+ unless app.config.active_record.delete(:observers).nil?
+ ActiveSupport::Deprecation.warn <<-EOF.strip_heredoc, []
+ Active Record Observers has been extracted out of Rails into a gem.
+ Please use callbaks or add `rails-observers` to your Gemfile to use observers.
+
+ To disable this message remove the `observers` option from your
+ `config/application.rb` or from your initializers.
+
+ See http://edgeguides.rubyonrails.org/4_0_release_notes.html for more information
+ EOF
+ end
ensure
ActiveSupport::Deprecation.behavior = old_behavior
end