From 2b166d306c7829c8be531cb030515166367cbb20 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 27 May 2009 16:49:23 -0700 Subject: Added support to new callbacks for around filter object that respond to :before & :after --- activesupport/lib/active_support/new_callbacks.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/lib/active_support/new_callbacks.rb') diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb index e9a30b9c35..5ca6b90b01 100644 --- a/activesupport/lib/active_support/new_callbacks.rb +++ b/activesupport/lib/active_support/new_callbacks.rb @@ -311,6 +311,11 @@ module ActiveSupport def #{method_name}(&blk) if :#{kind} == :around && #{method_name}_object.respond_to?(:filter) #{method_name}_object.send("filter", self, &blk) + # TODO: Deprecate this + elsif #{method_name}_object.respond_to?(:before) && #{method_name}_object.respond_to?(:after) + #{method_name}_object.before(self) + yield + #{method_name}_object.after(self) else #{method_name}_object.send("#{kind}_#{name}", self, &blk) end -- cgit v1.2.3