method
insert_record
v3.0.0 -
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 61
def insert_record(record, force = true, validate = true)
if record.new_record?
if force
record.save!
else
return false unless record.save(:validate => validate)
end
end
through_association = @owner.send(@reflection.through_reflection.name)
through_record = through_association.create!(construct_join_attributes(record))
through_association.proxy_target << through_record
end