class Sidekiq::Middleware::MultiTenant::Server

Pull the tenant out and run the current thread with it.

Public Instance Methods

call(worker_class, msg, queue) { || ... } click to toggle source
# File lib/activerecord-multi-tenant/sidekiq.rb, line 19
def call(worker_class, msg, queue)
  if msg.has_key?('multi_tenant')
    tenant = msg['multi_tenant']['class'].constantize.find(msg['multi_tenant']['id'])
    MultiTenant.with(tenant) do
      yield
    end
  else
    yield
  end
end