mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ask the association for records rather than calling send
This commit is contained in:
parent
d68419a88e
commit
e64b5da550
1 changed files with 2 additions and 1 deletions
|
@ -542,7 +542,8 @@ module ActiveRecord
|
|||
|
||||
def include_in_memory?(record)
|
||||
if reflection.is_a?(ActiveRecord::Reflection::ThroughReflection)
|
||||
owner.send(reflection.through_reflection.name).any? { |source|
|
||||
assoc = owner.association(reflection.through_reflection.name)
|
||||
assoc.reader.any? { |source|
|
||||
target = source.send(reflection.source_reflection.name)
|
||||
target.respond_to?(:include?) ? target.include?(record) : target == record
|
||||
} || target.include?(record)
|
||||
|
|
Loading…
Reference in a new issue