aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAlexey Nayden <alexey.nayden@gmail.com>2011-01-13 00:24:12 +0300
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-28 15:06:01 -0800
commite92c2ffd8eebf4b0b1f260cfe77c0d9690ba8fef (patch)
tree8763890b65829704fbaf648cbb4992c220e856b8 /activerecord/lib/active_record
parent2884482c3494b909e8e64751cfb0b588748d8854 (diff)
downloadrails-e92c2ffd8eebf4b0b1f260cfe77c0d9690ba8fef.tar.gz
rails-e92c2ffd8eebf4b0b1f260cfe77c0d9690ba8fef.tar.bz2
rails-e92c2ffd8eebf4b0b1f260cfe77c0d9690ba8fef.zip
Nested attributes and in-memory changed values #first and #[] behaviour consistency fix
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb2
1 files changed, 1 insertions, 1 deletions
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)