From e92c2ffd8eebf4b0b1f260cfe77c0d9690ba8fef Mon Sep 17 00:00:00 2001 From: Alexey Nayden Date: Thu, 13 Jan 2011 00:24:12 +0300 Subject: Nested attributes and in-memory changed values #first and #[] behaviour consistency fix --- activerecord/lib/active_record/associations/association_collection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 b75e02c66b..24fb49a65d 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -518,7 +518,7 @@ module ActiveRecord def fetch_first_or_last_using_find?(args) (args.first.kind_of?(Hash) && !args.first.empty?) || !(loaded? || @owner.new_record? || @reflection.options[:finder_sql] || - @target.any? { |record| record.new_record? } || args.first.kind_of?(Integer)) + @target.any? { |record| record.new_record? || record.changed? } || args.first.kind_of?(Integer)) end def include_in_memory?(record) -- cgit v1.2.3