diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-09 14:03:09 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-09 14:03:09 -0200 |
commit | 994a1c2a4747efcca3c6278c119096d93f793da1 (patch) | |
tree | 2367059a425f8434c8699733765baacdc2c2acff /activerecord/lib/active_record/associations/association_collection.rb | |
parent | 1f06652a57e727700c3a673dc1f86e3b1e07ce1f (diff) | |
download | rails-994a1c2a4747efcca3c6278c119096d93f793da1.tar.gz rails-994a1c2a4747efcca3c6278c119096d93f793da1.tar.bz2 rails-994a1c2a4747efcca3c6278c119096d93f793da1.zip |
Execute less operations
Diffstat (limited to 'activerecord/lib/active_record/associations/association_collection.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 398c41f3e9..71d8c2d3c8 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -545,8 +545,7 @@ module ActiveRecord def fetch_first_or_last_using_find?(args) args.first.kind_of?(Hash) || !(loaded? || !@owner.persisted? || @reflection.options[:finder_sql] || - @target.any? { |record| !record.persisted? } || args.first.kind_of?(Integer)) - # TODO - would prefer @target.none? { |r| r.persisted? } + !@target.all? { |record| record.persisted? } || args.first.kind_of?(Integer)) end def include_in_memory?(record) |