multi-tenant-support 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7761ff1721fab8904557ae7af54aca1875d19fb6076bbe5038493c945009eec
4
- data.tar.gz: 43df41f9e15014829828918d4703e77fe6f321bad2f10495e103860abe57cbbf
3
+ metadata.gz: f6c137c5f91a50070226bf5943aa074b8efb8041493e022b194e950c4a828900
4
+ data.tar.gz: 75981d65c8fcaee0be43716a4cd98529425847ff88c7dc428348fd557fb3ab89
5
5
  SHA512:
6
- metadata.gz: 7103aec88b69d628baed7e783495cc5e06b8fe49f5751d40aa5e676f2586aa7a0fcfe4d4f6015bfa4409017e533a3fff3a71b945d5426feb2ba5d7ba177f1ede
7
- data.tar.gz: f2e5c63298eee511690622da0d0c47bf0fcdeb80aff543704da2a2a7a047165d5d6eebfda3d44862003329fcc739a3d8278d3ffb7616667087d540c7f9e49006
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)
@@ -1,3 +1,3 @@
1
1
  module MultiTenantSupport
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
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.0
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-06 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails