Skip to content

Commit

Permalink
Use with_tenant in ActiveJob extension
Browse files Browse the repository at this point in the history
Implements the suggestion from ErwinM#328 (comment)
  • Loading branch information
phinze committed Jun 21, 2024
1 parent 7e3bd8a commit 6b2db3a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/acts_as_tenant/active_job_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ def serialize

def deserialize(job_data)
tenant_global_id = job_data.delete("current_tenant")
ActsAsTenant.current_tenant = tenant_global_id ? GlobalID::Locator.locate(tenant_global_id) : nil
super
tenant = tenant_global_id ? GlobalID::Locator.locate(tenant_global_id) : nil

ActsAsTenant.with_tenant tenant do
super
end
end
end
end

0 comments on commit 6b2db3a

Please sign in to comment.