Permalink
Browse files

Added support to new callbacks for around filter object that respond …

…to :before & :after
  • Loading branch information...
1 parent bd7e3dc commit 2b166d306c7829c8be531cb030515166367cbb20 Yehuda Katz + Carl Lerche committed May 27, 2009
Showing with 5 additions and 0 deletions.
  1. +5 −0 activesupport/lib/active_support/new_callbacks.rb
@@ -311,6 +311,11 @@ def #{method_name}
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

0 comments on commit 2b166d3

Please sign in to comment.