# File lib/mongoid/relations/referenced/many.rb, line 61 def build(attributes = {}, options = {}, type = nil) if options.is_a? Class options, type = {}, options end Factory.build(type || klass, attributes, options).tap do |doc| append(doc) yield(doc) if block_given? end end