method
insert_record
v4.2.1 -
Show latest stable
- Class:
ActiveRecord::Associations::HasManyThroughAssociation
insert_record(record, validate = true, raise = false)public
No documentation available.
# File activerecord/lib/active_record/associations/has_many_through_association.rb, line 55
def insert_record(record, validate = true, raise = false)
ensure_not_nested
if record.new_record?
if raise
record.save!(:validate => validate)
else
return unless record.save(:validate => validate)
end
end
save_through_record(record)
if has_cached_counter? && !through_reflection_updates_counter_cache?
ActiveSupport::Deprecation.warn( Automatic updating of counter caches on through associations has been deprecated, and will be removed in Rails 5. Instead, please set the appropriate `counter_cache` options on the `has_many` and `belongs_to` for your associations to #{through_reflection.name}..squish)
update_counter_in_database(1)
end
record
end