Skip to content

Commit

Permalink
ask the association for records rather than calling send
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Sep 10, 2013
1 parent d68419a commit e64b5da
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -542,7 +542,8 @@ def fetch_first_or_last_using_find?(args)

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)
Expand Down

0 comments on commit e64b5da

Please sign in to comment.