Sha256: 437a59f86d63ee0da3bf923ea430d54338f646d19bde7de15ce966f405e0c36a

Contents?: true

Size: 586 Bytes

Versions: 5

Compression:

Stored size: 586 Bytes

Contents

require './model/abstract_model'

module MongoModel
  include AbstractModel
  extend Forwardable
  def_delegators :scoped, :where, :limit, :skip, :sort, :count,
                          :last, :first, :all, :paginate, :find,
                          :find!, :exists?, :exist?, :find_each
  
  def scoped(scope={})
    Query.new(self, nil, collection, scope)
  end
  
  def load(values)
    new(values, false)
  end
  
  def collection(*name)
    if name.size == 1
      @collection = Yodel.db.collection(name.first, pk: PrimaryKeyFactory)
    else
      @collection
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/core/model/mongo_model.rb
yodel-0.0.4 lib/yodel/models/core/model/mongo_model.rb
yodel-0.0.3 lib/yodel/models/core/model/mongo_model.rb
yodel-0.0.2 lib/yodel/models/core/model/mongo_model.rb
yodel-0.0.1 lib/yodel/models/core/model/mongo_model.rb