Module: ActiveRecord::JSONB::Associations::BelongsToAssociation

Defined in:
lib/activerecord/jsonb/associations/belongs_to_association.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#replace_keys(record, force: false) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/activerecord/jsonb/associations/belongs_to_association.rb', line 5

def replace_keys(record, force: false)
  return super unless reflection.options.key?(:store)

  owner[reflection.options[:store]][reflection.foreign_key] =
    record._read_attribute(
      reflection.association_primary_key(record.class)
    )
end