Permalink
Browse files

Nested attributes and in-memory changed values #first and #[] behavio…

…ur consistency fix
  • Loading branch information...
anayden authored and tenderlove committed Jan 12, 2011
1 parent 2884482 commit e92c2ffd8eebf4b0b1f260cfe77c0d9690ba8fef
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/associations/association_collection.rb
@@ -518,7 +518,7 @@ def ensure_owner_is_persisted!
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)

0 comments on commit e92c2ff

Please sign in to comment.