instance method
association_foreign_key_changed?
Ruby on Rails 7.0.10
Since v5.2.8.1 PrivateSignature
association_foreign_key_changed?(reflection, record, key)
No documentation comment.
Parameters
-
reflectionreq -
recordreq -
keyreq
Source
# File activerecord/lib/active_record/autosave_association.rb, line 470
def association_foreign_key_changed?(reflection, record, key)
return false if reflection.through_reflection?
record._has_attribute?(reflection.foreign_key) && record._read_attribute(reflection.foreign_key) != key
end
Defined in activerecord/lib/active_record/autosave_association.rb line 470
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AutosaveAssociation