lib/rocket_job/extensions/mongoid/factory.rb in rocketjob-3.5.2 vs lib/rocket_job/extensions/mongoid/factory.rb in rocketjob-4.0.0

- old
+ new

@@ -1,13 +1,13 @@ require 'mongoid/factory' module RocketJob # Don't convert to Mongoid::Factory since it conflicts with Mongoid use. module MongoidFactory - def from_db(klass, attributes = nil, selected_fields = nil) - super - rescue NameError - RocketJob::Job.instantiate(attributes, selected_fields) + def from_db(klass, attributes = nil, criteria = nil) + obj = super(klass, attributes, criteria) + obj.collection_name = criteria.collection_name if criteria + obj end end end ::Mongoid::Factory.extend(RocketJob::MongoidFactory)