Sha256: af1c5f547e485e73b04db45f4e1ccc5f79fd479266e0062287315bdea08eec53

Contents?: true

Size: 702 Bytes

Versions: 17

Compression:

Stored size: 702 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)
      if criteria.klass.embedded?
        return Contexts::Enumerable.new(criteria)
      end
      Contexts::Mongo.new(criteria)
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
mongoid-2.0.0.beta.20 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.19 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.18 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.17 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.16 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.15 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.14 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.13 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.11 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.10 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.7 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.8 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.9 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.12 lib/mongoid/contexts.rb
mongoid-locomotive-2.0.0.beta9 lib/mongoid/contexts.rb
chhean-mongoid-2.0.1.beta1 lib/mongoid/contexts.rb
mongoid-2.0.0.beta.5 lib/mongoid/contexts.rb