lib/mongoid/factory.rb in mongoid-2.0.0.rc.7 vs lib/mongoid/factory.rb in mongoid-2.0.0.rc.8

- old
+ new

@@ -12,9 +12,9 @@ # klass: The class to instantiate from if _type is not present. # attributes: The +Document+ attributes. def self.build(klass, attributes) attrs = {}.merge(attributes) type = attrs["_type"] - type ? type.constantize.instantiate(attrs) : klass.instantiate(attrs) + type.present? ? type.constantize.instantiate(attrs) : klass.instantiate(attrs) end end end