From 88230b7cf77181c2088cce3314493caa9b3ac1fb Mon Sep 17 00:00:00 2001 From: Bogdan Gusiev Date: Sun, 24 Jun 2012 10:30:34 +0300 Subject: AS::Callbacks: deprecate monkey patch code Deprecate usage of filter object with #before and #after methods as around callback --- activesupport/lib/active_support/callbacks.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/lib') 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 -- cgit v1.2.3