From 1e2628431a742e4f67af1d5dc1db8ad6393e8832 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 27 May 2009 16:50:40 -0700 Subject: Added support to new callbacks for around filter object that respond to :before & :after used in before|after callbacks --- activesupport/lib/active_support/new_callbacks.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb index 5ca6b90b01..185fb6a6af 100644 --- a/activesupport/lib/active_support/new_callbacks.rb +++ b/activesupport/lib/active_support/new_callbacks.rb @@ -324,7 +324,11 @@ module ActiveSupport else @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{method_name}(&blk) - #{method_name}_object.send("#{kind}_#{name}", self, &blk) + if #{method_name}_object.respond_to?(:#{kind}) + #{method_name}_object.#{kind}(self, &blk) + else + #{method_name}_object.send("#{kind}_#{name}", self, &blk) + end end RUBY_EVAL end -- cgit v1.2.3