lib/mongoid/factory.rb in mongoid-3.1.7 vs lib/mongoid/factory.rb in mongoid-4.0.0.alpha1
- old
+ new
@@ -13,15 +13,15 @@
# @param [ Class ] klass The class to instantiate from if _type is not present.
# @param [ Hash ] attributes The document attributes.
# @param [ Hash ] options The mass assignment scoping options.
#
# @return [ Document ] The instantiated document.
- def build(klass, attributes = nil, options = {})
+ def build(klass, attributes = nil)
type = (attributes || {})["_type"]
if type && klass._types.include?(type)
- type.constantize.new(attributes, options)
+ type.constantize.new(attributes)
else
- klass.new(attributes, options)
+ klass.new(attributes)
end
end
# Builds a new +Document+ from the supplied attributes loaded from the
# database.