multi-tenant-support 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/multi_tenant_support/active_job.rb +39 -1
- data/lib/multi_tenant_support/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6c137c5f91a50070226bf5943aa074b8efb8041493e022b194e950c4a828900
|
4
|
+
data.tar.gz: 75981d65c8fcaee0be43716a4cd98529425847ff88c7dc428348fd557fb3ab89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 648bafb81bc655e8b5e5ce5f69cb5396c3d462e6ac67f6d95492a8f23063869c2202457fc76e944d5059bf9cd7fc6d77e898550851e40af5a88c2a912bb4d25c
|
7
|
+
data.tar.gz: 984a0ab95e23d14bbe45f4814d265c5afb7b90a05147d7a3e31f2d2eec587c2e088a1a57adfea8316bf7137ff7f73d2c0500257cb1eb95fc734b7c94888d7b04
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module MultiTenantSupport
|
2
|
+
|
2
3
|
module ActiveJob
|
3
4
|
extend ActiveSupport::Concern
|
4
5
|
|
@@ -6,6 +7,24 @@ module MultiTenantSupport
|
|
6
7
|
attr_accessor :current_tenant
|
7
8
|
end
|
8
9
|
|
10
|
+
class_methods do
|
11
|
+
if Gem::Version.new(Rails.version) < Gem::Version.new("7.0.0.alpha1")
|
12
|
+
def perform_now(*args)
|
13
|
+
job = job_or_instantiate(*args)
|
14
|
+
job.current_tenant = MultiTenantSupport.current_tenant
|
15
|
+
job.perform_now
|
16
|
+
end
|
17
|
+
else
|
18
|
+
eval("
|
19
|
+
def perform_now(...)
|
20
|
+
job = job_or_instantiate(...)
|
21
|
+
job.current_tenant = MultiTenantSupport.current_tenant
|
22
|
+
job.perform_now
|
23
|
+
end
|
24
|
+
")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
9
28
|
def perform_now
|
10
29
|
MultiTenantSupport.under_tenant(current_tenant) do
|
11
30
|
super
|
@@ -43,6 +62,25 @@ module MultiTenantSupport
|
|
43
62
|
tenant_klass.find tenant_id
|
44
63
|
end
|
45
64
|
end
|
65
|
+
|
66
|
+
module ConfiguredJob
|
67
|
+
if Gem::Version.new(Rails.version) < Gem::Version.new("7.0.0.alpha1")
|
68
|
+
def perform_now(*args)
|
69
|
+
job = @job_class.new(*args)
|
70
|
+
job.current_tenant = MultiTenantSupport.current_tenant
|
71
|
+
job.perform_now
|
72
|
+
end
|
73
|
+
else
|
74
|
+
eval("
|
75
|
+
def perform_now(...)
|
76
|
+
job = @job_class.new(...)
|
77
|
+
job.current_tenant = MultiTenantSupport.current_tenant
|
78
|
+
job.perform_now
|
79
|
+
end
|
80
|
+
")
|
81
|
+
end
|
82
|
+
end
|
46
83
|
end
|
47
84
|
|
48
|
-
ActiveJob::Base.include(MultiTenantSupport::ActiveJob)
|
85
|
+
ActiveJob::Base.include(MultiTenantSupport::ActiveJob)
|
86
|
+
ActiveJob::ConfiguredJob.prepend(MultiTenantSupport::ConfiguredJob)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi-tenant-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hopper Gee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|