aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-13 16:43:27 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-13 16:43:27 -0700
commitccbefff684d63c71e13fbb7507fa41d3400c0c95 (patch)
tree4ec1002dafcee3d7f388e0812f9d3a31b7a4b8dc /activesupport
parent877964dc61d56f7579871ad434622748f4e208f9 (diff)
downloadrails-ccbefff684d63c71e13fbb7507fa41d3400c0c95.tar.gz
rails-ccbefff684d63c71e13fbb7507fa41d3400c0c95.tar.bz2
rails-ccbefff684d63c71e13fbb7507fa41d3400c0c95.zip
if there is nothing to compile, then do not bother compiling
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/callbacks.rb11
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