method
insert_record
![No documentation Importance_0](https://d2vfyqvduarcvs.cloudfront.net/images/importance_0.png?1349367920)
v2.3.8 -
Show latest stable
-
0 notes -
Class: ActiveRecord::Associations::HasManyThroughAssociation
insert_record(record, force = true, validate = true)
protected
Hide source
# 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