diff options
author | Michael S. Klishin <michael@novemberain.com> | 2008-12-29 00:15:52 +0300 |
---|---|---|
committer | Michael S. Klishin <michael@novemberain.com> | 2008-12-29 00:16:42 +0300 |
commit | 19208e7422e191098bdbe3d12b75296777e2c75d (patch) | |
tree | 2466083ad1b0dbdc5226f833bf8fa629277aaaae /activesupport/lib/active_support/callbacks.rb | |
parent | bdba0b9a7a2e3a593e44a64b38c31fa05ac0260c (diff) | |
parent | 45dee3842d68359a189fe7c0729359bd5a905ea4 (diff) | |
download | rails-19208e7422e191098bdbe3d12b75296777e2c75d.tar.gz rails-19208e7422e191098bdbe3d12b75296777e2c75d.tar.bz2 rails-19208e7422e191098bdbe3d12b75296777e2c75d.zip |
Pull up some other changes from rails/rails/master
Diffstat (limited to 'activesupport/lib/active_support/callbacks.rb')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 99a39f8450..4bac8292e2 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -192,13 +192,8 @@ module ActiveSupport end def should_run_callback?(*args) - if options[:if] - evaluate_method(options[:if], *args) - elsif options[:unless] - !evaluate_method(options[:unless], *args) - else - true - end + [options[:if]].flatten.compact.all? { |a| evaluate_method(a, *args) } && + ![options[:unless]].flatten.compact.any? { |a| evaluate_method(a, *args) } end end |