提交 ccbefff6 编写于 作者: A Aaron Patterson

if there is nothing to compile, then do not bother compiling

上级 877964dc
......@@ -76,9 +76,14 @@ module Callbacks
# save
# end
def run_callbacks(kind, &block)
runner = send("_#{kind}_callbacks").compile
e = Filters::Environment.new(self, false, nil, block)
runner.call(e).value
cbs = send("_#{kind}_callbacks")
if cbs.empty?
yield if block_given?
else
runner = cbs.compile
e = Filters::Environment.new(self, false, nil, block)
runner.call(e).value
end
end
private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册