Added support to new callbacks for around filter object that respond to :before & :after

This commit is contained in:
Yehuda Katz + Carl Lerche
2009-05-27 16:49:23 -07:00
parent bd7e3dc47d
commit 2b166d306c

View File

@@ -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