method
insert_record
v2.3.8 -
Show latest stable
- Class:
ActiveRecord::Associations::HasManyThroughAssociation
insert_record(record, force = true, validate = true)protected
No documentation available.
# File activerecord/lib/active_record/associations/has_many_through_association.rb, line 55
def insert_record(record, force = true, validate = true)
if record.new_record?
if force
record.save!
else
return false unless record.save(validate)
end
end
through_reflection = @reflection.through_reflection
klass = through_reflection.klass
@owner.send(@reflection.through_reflection.name).proxy_target << klass.send(:with_scope, :create => construct_join_attributes(record)) { through_reflection.create_association! }
end