Class: MultiTenantSupport::Sidekiq::Server
- Inherits:
-
Object
- Object
- MultiTenantSupport::Sidekiq::Server
- Defined in:
- lib/multi_tenant_support/sidekiq.rb
Instance Method Summary collapse
Instance Method Details
#call(worker_instance, msg, queue) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/multi_tenant_support/sidekiq.rb', line 18 def call(worker_instance, msg, queue) if msg.has_key?("multi_tenant_support") tenant_klass = msg["multi_tenant_support"]["class"].constantize tenant_id = msg["multi_tenant_support"]["id"] tenant_account = nil MultiTenantSupport.allow_read_across_tenant do tenant_account = tenant_klass.find tenant_id end MultiTenantSupport.under_tenant tenant_account do yield end else yield end end |