Module: MongoModel::Attributes::ClassMethods

Defined in:
lib/mongomodel/concerns/attributes.rb

Instance Method Summary collapse

Instance Method Details

#from_mongo(hash) ⇒ Object


73
74
75
76
77
78
79
# File 'lib/mongomodel/concerns/attributes.rb', line 73

def from_mongo(hash)
  if hash
    doc = class_for_type(hash['_type']).new
    doc.attributes.load!(hash)
    doc
  end
end