Module: MultiTenantSupport::ActiveJob

Extended by:
ActiveSupport::Concern
Defined in:
lib/multi_tenant_support/active_job.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(job_data) ⇒ Object



63
64
65
66
67
68
# File 'lib/multi_tenant_support/active_job.rb', line 63

def deserialize(job_data)
  self.current_tenant = find_current_tenant(job_data)
  MultiTenantSupport.under_tenant(current_tenant) do
    super
  end
end

#perform_nowObject



44
45
46
47
48
# File 'lib/multi_tenant_support/active_job.rb', line 44

def perform_now
  MultiTenantSupport.under_tenant(current_tenant) do
    super
  end
end

#serializeObject



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/multi_tenant_support/active_job.rb', line 50

def serialize
  if MultiTenantSupport.current_tenant
    super.merge({
      "multi_tenant_support" => {
        "id" => MultiTenantSupport.current_tenant.id,
        "class" => MultiTenantSupport.current_tenant.class.name
      }
    })
  else
    super
  end
end