Module: MongoModel

Extended by:
Forwardable
Includes:
AbstractModel
Included in:
MongoRecord, RecordIndex, SiteModel
Defined in:
lib/yodel/models/core/model/mongo_model.rb

Instance Method Summary collapse

Methods included from AbstractModel

#embed_many, #embed_one, #field, #fields, #many, #modify_field, #one, #remove_field

Instance Method Details

#collection(*name) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/yodel/models/core/model/mongo_model.rb', line 18

def collection(*name)
  if name.size == 1
    @collection = Yodel.db.collection(name.first, pk: PrimaryKeyFactory)
  else
    @collection
  end
end

#load(values) ⇒ Object



14
15
16
# File 'lib/yodel/models/core/model/mongo_model.rb', line 14

def load(values)
  new(values, false)
end

#scoped(scope = {}) ⇒ Object



10
11
12
# File 'lib/yodel/models/core/model/mongo_model.rb', line 10

def scoped(scope={})
  Query.new(self, nil, collection, scope)
end