instance method
record_changed?
Ruby on Rails 6.1.7.10
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 479
def record_changed?(reflection, record, key)
record.new_record? ||
association_foreign_key_changed?(reflection, record, key) ||
record.will_save_change_to_attribute?(reflection.foreign_key)
end
Defined in activerecord/lib/active_record/autosave_association.rb line 479
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AutosaveAssociation