diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-06-26 01:30:15 -0700 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-06-26 01:30:15 -0700 |
commit | cfd21f01474ca9f0e1650fad321e91bd47547167 (patch) | |
tree | 1937557bc2d73cef7a676ddaa39bc01b739a26a5 /activesupport | |
parent | a5ebf33b8fadb721186c23cb4605f33604c5a91b (diff) | |
parent | 88230b7cf77181c2088cce3314493caa9b3ac1fb (diff) | |
download | rails-cfd21f01474ca9f0e1650fad321e91bd47547167.tar.gz rails-cfd21f01474ca9f0e1650fad321e91bd47547167.tar.bz2 rails-cfd21f01474ca9f0e1650fad321e91bd47547167.zip |
Merge pull request #6859 from bogdan/deprecate_monkey_patch
AS::Callbacks: deprecate monkey patch code
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 00fcfe2001..87b956e3fc 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,7 @@ ## Rails 4.0.0 (unreleased) ## +* AS::Callbacks: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev* + * Add `Time#prev_quarter' and 'Time#next_quarter' short-hands for months_ago(3) and months_since(3). *SungHee Kang* * Remove obsolete and unused `require_association` method from dependencies. *fxn* diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 0aa3efbb63..6cc875c69a 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -283,7 +283,8 @@ module ActiveSupport filter.singleton_class.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{kind}(context, &block) filter(context, &block) end RUBY_EVAL - elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around + elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around && !filter.respond_to?(:around) + ActiveSupport::Deprecation.warn("Filter object with #before and #after methods is deprecated. Define #around method instead.") def filter.around(context) should_continue = before(context) yield if should_continue |