aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_collection.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-12 18:01:02 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-12 18:07:53 -0800
commit3165dca28c1db741994c3176e7b158a9f684e816 (patch)
tree6456a3c446fe42bdb834fd222c59c9d8e7459c5e /activerecord/lib/active_record/associations/association_collection.rb
parentf2beb56c8b14326f35af887ef0d2ee6356946065 (diff)
downloadrails-3165dca28c1db741994c3176e7b158a9f684e816.tar.gz
rails-3165dca28c1db741994c3176e7b158a9f684e816.tar.bz2
rails-3165dca28c1db741994c3176e7b158a9f684e816.zip
include_in_memory? should check against @target list in case of new records. [#6257 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record/associations/association_collection.rb')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb
index da3800bf4a..e65ef2b768 100644
--- a/activerecord/lib/active_record/associations/association_collection.rb
+++ b/activerecord/lib/active_record/associations/association_collection.rb
@@ -518,10 +518,10 @@ module ActiveRecord
def include_in_memory?(record)
if @reflection.is_a?(ActiveRecord::Reflection::ThroughReflection)
- @owner.send(proxy_reflection.through_reflection.name).any? do |source|
+ @owner.send(proxy_reflection.through_reflection.name).any? { |source|
target = source.send(proxy_reflection.source_reflection.name)
target.respond_to?(:include?) ? target.include?(record) : target == record
- end
+ } || @target.include?(record)
else
@target.include?(record)
end