Class: Mongoid::Contextual::Mongo
- Inherits:
-
Object
- Object
- Mongoid::Contextual::Mongo
- Defined in:
- lib/rocket_job/extensions/mongoid/contextual/mongo.rb
Instance Method Summary collapse
-
#initialize(criteria) ⇒ Mongo
constructor
A new instance of Mongo.
Constructor Details
#initialize(criteria) ⇒ Mongo
Returns a new instance of Mongo.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rocket_job/extensions/mongoid/contextual/mongo.rb', line 5 def initialize(criteria) @criteria = criteria @klass = criteria.klass @cache = criteria.[:cache] # Only line changed is here, get collection name from criteria, not @klass # @collection = @klass.collection @collection = criteria.collection criteria.send(:merge_type_selection) @view = collection.find(criteria.selector, session: _session) end |