Class: ActsAsTenant::Sidekiq::Server
- Inherits:
-
BaseMiddleware
- Object
- BaseMiddleware
- ActsAsTenant::Sidekiq::Server
- Includes:
- Sidekiq::ServerMiddleware
- Defined in:
- lib/acts_as_tenant/sidekiq.rb
Overview
Pull the tenant out and run the current thread with it.
Instance Method Summary collapse
Methods inherited from BaseMiddleware
Instance Method Details
#call(worker_class, msg, queue) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/acts_as_tenant/sidekiq.rb', line 29 def call(worker_class, msg, queue) if msg.has_key?("acts_as_tenant") klass = msg["acts_as_tenant"]["class"].constantize id = msg["acts_as_tenant"]["id"] account = klass.class_eval(&ActsAsTenant.configuration.job_scope).find(id) ActsAsTenant.with_tenant account do yield end else yield end end |