Method: ActiveRecord::Associations::HasManyThroughAssociation#insert_record

Defined in:
activerecord/lib/active_record/associations/has_many_through_association.rb

#insert_record(record, validate = true, raise = false) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'activerecord/lib/active_record/associations/has_many_through_association.rb', line 24

def insert_record(record, validate = true, raise = false)
  ensure_not_nested

  if record.new_record? || record.has_changes_to_save?
    return unless super
  end

  save_through_record(record)

  record
end