1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

This commit is contained in:
Aaron Patterson 2013-05-13 16:43:27 -07:00
parent 877964dc61
commit ccbefff684

View file

@ -76,9 +76,14 @@ module ActiveSupport
# 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