method
build_record
v3.2.1 -
Show latest stable
- Class:
ActiveRecord::Associations::HasManyThroughAssociation
build_record(attributes, options = {})private
No documentation available.
# File activerecord/lib/active_record/associations/has_many_through_association.rb, line 88
def build_record(attributes, options = {})
ensure_not_nested
record = super(attributes, options)
inverse = source_reflection.inverse_of
if inverse
if inverse.macro == :has_many
record.send(inverse.name) << build_through_record(record)
elsif inverse.macro == :has_one
record.send("#{inverse.name}=", build_through_record(record))
end
end
record
end