Module: Mongo::Model::ClassMethods

Defined in:
lib/mongo/model/model.rb

Instance Method Summary collapse

Instance Method Details

#embedded(*list) ⇒ Object



69
70
71
72
# File 'lib/mongo/model/model.rb', line 69

def embedded *list
  list.collect!{|n| :"@#{n}"}
  if list.empty? then _embedded else _embedded.push(*list) end
end

#from_mongo(doc) ⇒ Object



74
75
76
77
78
# File 'lib/mongo/model/model.rb', line 74

def from_mongo doc
  model = ::Mongo::Object.from_mongo doc
  model.run_after_callbacks :build, :build
  model
end