diff options
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 6ffe8a750d..8422d4f5f3 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -76,9 +76,14 @@ module ActiveSupport # 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 |