method
insert_record
v2.2.1 -
Show latest stable
-
0 notes -
Class: ActiveRecord::Associations::HasManyThroughAssociation
insert_record(record, force=true)
protected
Hide source
# File activerecord/lib/active_record/associations/has_many_through_association.rb, line 50 def insert_record(record, force=true) if record.new_record? if force record.save! else return false unless record.save 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