Module: Delayed::Backend::Base::ClassMethods

Defined in:
lib/acts_as_tenant/delayed_job/delayed_job_backend.rb

Instance Method Summary collapse

Instance Method Details

#enqueue(*args) ⇒ Object

Add a job to the queue



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/acts_as_tenant/delayed_job/delayed_job_backend.rb', line 9

def enqueue(*args)
  if ActsAsTenant.current_tenant
    args[0].job_data["acts_as_tenant"] = {
      "tenant_class" => ActsAsTenant.current_tenant.class.name,
      "tenant_id" => ActsAsTenant.current_tenant.id
    }
  end

  job_options = Delayed::Backend::JobPreparer.new(*args).prepare
  enqueue_job(job_options)
end