Sha256: ffeb9eb2ba5d1d38f487c804db1ef7ad6434e4d85cd2541cf8ab82fbb5ec9021

Contents?: true

Size: 450 Bytes

Versions: 12

Compression:

Stored size: 450 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, criteria = nil, selected_fields = nil)
      obj                 = super(klass, attributes, criteria, selected_fields)
      obj.collection_name = criteria.collection_name if criteria
      obj
    end
  end
end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rocketjob-6.3.1 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.3.0 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.2.0 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.1.1 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.1.0 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.3 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.2 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.1 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.0 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.0.rc3 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.0.rc2 lib/rocket_job/extensions/mongoid/factory.rb
rocketjob-6.0.0.rc1 lib/rocket_job/extensions/mongoid/factory.rb