From 994a1c2a4747efcca3c6278c119096d93f793da1 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 9 Nov 2010 14:03:09 -0200 Subject: Execute less operations --- activerecord/lib/active_record/associations/association_collection.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib/active_record') 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) -- cgit v1.2.3