diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-08-17 17:09:39 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-08-17 18:22:29 +0100 |
commit | 2ff47c48975b52a23982fc7bae592ab32d4fff2e (patch) | |
tree | 19dadbaf6196d2b0e3afb57ea90187be9f7b9eef /activerecord | |
parent | 8fcd9b6e86274cc36820bfbf55a9d2967177339a (diff) | |
download | rails-2ff47c48975b52a23982fc7bae592ab32d4fff2e.tar.gz rails-2ff47c48975b52a23982fc7bae592ab32d4fff2e.tar.bz2 rails-2ff47c48975b52a23982fc7bae592ab32d4fff2e.zip |
Avoid #any?
any? will check that each item in the array is truthy, as opposed to
!empty? which will simply check that the array has length. For an empty
array, !empty? still seems to be faster than any?
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index e35f952151..cde3325919 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -188,7 +188,7 @@ module ActiveRecord assign_attributes(attributes, options) if attributes yield self if block_given? - run_callbacks :initialize if _initialize_callbacks.any? + run_callbacks :initialize unless _initialize_callbacks.empty? end # Initialize an empty model object from +coder+. +coder+ must contain |