method
construct_model
v5.2.3 -
Show latest stable
- Class:
ActiveRecord::Associations::JoinDependency
construct_model(record, node, row, model_cache, id, aliases)private
No documentation available.
# File activerecord/lib/active_record/associations/join_dependency.rb, line 244
def construct_model(record, node, row, model_cache, id, aliases)
other = record.association(node.reflection.name)
model = model_cache[node][id] ||=
node.instantiate(row, aliases.column_aliases(node)) do |m|
other.set_inverse_instance(m)
end
if node.reflection.collection?
other.target.push(model)
else
other.target = model
end
model
end