method
create
v2.3.8 -
Show latest stable
- Class:
ActiveRecord::Associations::HasManyThroughAssociation
create(attrs = nil)public
No documentation available.
# File activerecord/lib/active_record/associations/has_many_through_association.rb, line 13
def create(attrs = nil)
transaction do
object = if attrs
@reflection.klass.send(:with_scope, :create => attrs) {
@reflection.create_association
}
else
@reflection.create_association
end
raise_on_type_mismatch(object)
add_record_to_target_with_callbacks(object) do |r|
insert_record(object, false)
end
object
end
end