instance method
_record_changed?
Ruby on Rails edge
Since v7.0.10 Private — implementation detail, not part of the public APISignature
_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 515
def _record_changed?(reflection, record, key)
record.new_record? ||
(association_foreign_key_changed?(reflection, record, key) ||
inverse_polymorphic_association_changed?(reflection, record)) ||
ActiveRecord::Key.for(reflection.foreign_key).any? { |fk| record.will_save_change_to_attribute?(record.class.attribute_aliases[fk] || fk) }
end
Defined in activerecord/lib/active_record/autosave_association.rb line 515
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AutosaveAssociation