aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2012-06-24 10:30:34 +0300
committerBogdan Gusiev <agresso@gmail.com>2012-06-26 09:21:36 +0300
commit88230b7cf77181c2088cce3314493caa9b3ac1fb (patch)
treead9c79bb1bb14f6f2d11fc0a9c428faab5416e24 /activesupport/lib
parent755d1636107f814c6e0f76e7b3f327b9b4bdcc07 (diff)
downloadrails-88230b7cf77181c2088cce3314493caa9b3ac1fb.tar.gz
rails-88230b7cf77181c2088cce3314493caa9b3ac1fb.tar.bz2
rails-88230b7cf77181c2088cce3314493caa9b3ac1fb.zip
AS::Callbacks: deprecate monkey patch code
Deprecate usage of filter object with #before and #after methods as around callback
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/callbacks.rb3
1 files changed, 2 insertions, 1 deletions
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