class ActiveRecord::Associations::CollectionAssociation

def build(attributes = nil, &block)

def build(attributes = nil, &block)
  if attributes.is_a?(Array)
    attributes.collect { |attr| build(attr, &block) }
  else
    add_to_target(build_record(attributes, &block), replace: true)
  end
end