lib/rocket_job/extensions/mongoid/factory.rb in rocketjob-3.5.0 vs lib/rocket_job/extensions/mongoid/factory.rb in rocketjob-3.5.1
- old
+ new
@@ -1,15 +1,14 @@
require 'mongoid/factory'
module RocketJob
- module Mongoid
- module Factory
- def from_db(*args)
- super(*args)
- rescue NameError
- RocketJob::Job.instantiate(attributes, selected_fields)
- end
+ # 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)
end
end
end
-::Mongoid::Factory.extend(RocketJob::Mongoid::Factory)
+::Mongoid::Factory.extend(RocketJob::MongoidFactory)