提交 f862376d 编写于 作者: R Rafael Mendonça França

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.
上级 ccecab3b
......@@ -115,6 +115,18 @@ class Railtie < Rails::Railtie # :nodoc:
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册