Browse files

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.
  • Loading branch information...
1 parent a569ee3 commit 0af5af83ac597a60330f9f98687cc3be9030cb92 @rafaelfranca committed Nov 28, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 activerecord/lib/active_record/railtie.rb
@@ -115,6 +115,18 @@ class Railtie < Rails::Railtie # :nodoc:
See for more information
+ 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 for more information
+ end
ActiveSupport::Deprecation.behavior = old_behavior

0 comments on commit 0af5af8

Please sign in to comment.