mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
ccecab3ba9
commit
f862376d16
1 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue