method
replace_keys
v6.1.3.1 -
Show latest stable
- Class:
ActiveRecord::Associations::BelongsToPolymorphicAssociation
replace_keys(record, force: false)private
No documentation available.
# File activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb, line 17
def replace_keys(record, force: false)
super
target_type = record ? record.class.polymorphic_name : nil
if force || owner[reflection.foreign_type] != target_type
owner[reflection.foreign_type] = target_type
end
end