method
replace_keys
rails 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 25
def replace_keys(record, force: false)
super
target_type = record ? record.class.polymorphic_name : nil
if force || owner._read_attribute(reflection.foreign_type) != target_type
owner[reflection.foreign_type] = target_type
end
end