method
include_in_memory?
v4.2.1 -
Show latest stable
- Class:
ActiveRecord::Associations::CollectionAssociation
include_in_memory?(record)private
No documentation available.
# File activerecord/lib/active_record/associations/collection_association.rb, line 606
def include_in_memory?(record)
if reflection.is_a?(ActiveRecord::Reflection::ThroughReflection)
assoc = owner.association(reflection.through_reflection.name)
assoc.reader.any? { |source|
target_association = source.send(reflection.source_reflection.name)
if target_association.respond_to?(:include?)
target_association.include?(record)
else
target_association == record
end
} || target.include?(record)
else
target.include?(record)
end
end