method
matches_foreign_key?
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::Associations::Association
matches_foreign_key?(record)private
No documentation available.
# File activerecord/lib/active_record/associations/association.rb, line 387
def matches_foreign_key?(record)
if foreign_key_for?(record)
record.read_attribute(reflection.foreign_key) == owner.id ||
(foreign_key_for?(owner) && owner.read_attribute(reflection.foreign_key) == record.id)
else
owner.read_attribute(reflection.foreign_key) == record.id
end
end