method
replace
Ruby on Rails latest stable (v7.1.3.2)
-
0 notes -
Class: ActiveRecord::Associations::BelongsToAssociation
replace(record)
private
Hide source
# File activerecord/lib/active_record/associations/belongs_to_association.rb, line 89 def replace(record) if record raise_on_type_mismatch!(record) set_inverse_instance(record) @updated = true elsif target remove_inverse_instance(target) end replace_keys(record, force: true) self.target = record end