lib/mongomodel/concerns/attributes.rb in mongomodel-0.1.1 vs lib/mongomodel/concerns/attributes.rb in mongomodel-0.1.3
- old
+ new
@@ -67,15 +67,15 @@
doc
end
private
def class_for_type(type)
- type = type.constantize
+ klass = type.constantize
- if (subclasses + [name]).include?(type.to_s)
- type
+ if (subclasses + [name]).include?(type)
+ klass
else
- raise DocumentNotFound, "Document not of the correct type (got #{type.to_s})"
+ raise DocumentNotFound, "Document not of the correct type (got #{type})"
end
rescue NameError
self
end
end