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

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

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