Sha256: 57482a6a229db46e6555670e8985ec41992048e82bae36cecaba956e275d3cbe

Contents?: true

Size: 654 Bytes

Versions: 8

Compression:

Stored size: 654 Bytes

Contents

# encoding: utf-8
require "mongoid/contexts/ids"
require "mongoid/contexts/paging"
require "mongoid/contexts/enumerable"
require "mongoid/contexts/mongo"

module Mongoid
  module Contexts
    # Determines the context to be used for this criteria. If the class is an
    # embedded document, then the context will be the array in the has_many
    # association it is in. If the class is a root, then the database itself
    # will be the context.
    #
    # Example:
    #
    # <tt>Contexts.context_for(criteria)</tt>
    def self.context_for(criteria, embedded = false)
      embedded ? Enumerable.new(criteria) : Mongo.new(criteria)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
mongoid-2.0.0.rc.7 lib/mongoid/contexts.rb
stonegao-mongoid-2.0.0.rc.6 lib/mongoid/contexts.rb
mongoid-2.0.0.rc.6 lib/mongoid/contexts.rb
mongoid-2.0.0.rc.5 lib/mongoid/contexts.rb
mongoid-2.0.0.rc.4 lib/mongoid/contexts.rb
mongoid-2.0.0.rc.3 lib/mongoid/contexts.rb
mongoid-2.0.0.rc.2 lib/mongoid/contexts.rb
mongoid-2.0.0.rc.1 lib/mongoid/contexts.rb