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