From f862376d169acfe362552787c095ff4b93834f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 28 Nov 2012 21:55:07 -0200 Subject: 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. --- activerecord/lib/active_record/railtie.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3