Sha256: 58bf1f47fbce11360a9b473b43bc5e68a020f613288eac79a6ff12bd63c96ad7

Contents?: true

Size: 374 Bytes

Versions: 2

Compression:

Stored size: 374 Bytes

Contents

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)
    end
  end
end

::Mongoid::Factory.extend(RocketJob::MongoidFactory)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rocketjob-3.5.2 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-3.5.1 lib/rocket_job/extensions/mongoid/factory.rb