instance method
record_changed?
Ruby on Rails 4.2.9
Since v4.0.13 Last seen in v6.1.7.10 PrivateSignature
record_changed?(reflection, record, key)
If the record is new or it has changed, returns true.
Parameters
-
reflectionreq -
recordreq -
keyreq
Source
# File activerecord/lib/active_record/autosave_association.rb, line 422
def record_changed?(reflection, record, key)
record.new_record? ||
(record.has_attribute?(reflection.foreign_key) && record[reflection.foreign_key] != key) ||
record.attribute_changed?(reflection.foreign_key)
end
Defined in activerecord/lib/active_record/autosave_association.rb line 422
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AutosaveAssociation