acts_as_tenant 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_tenant/model_extensions.rb +3 -3
- data/lib/acts_as_tenant/sidekiq.rb +12 -2
- data/lib/acts_as_tenant/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df411b08fd69234fdd767f98232148eef42a147986b9417eb08f8f0dbdbd5479
|
4
|
+
data.tar.gz: 25b9bdd0ab15e9b08ddea8b7b310a7d2968529b882409551209d4a59b9157a20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 119a2b3e43b5a04f589f352943121d483d12c4ab44ec73ef493453bccc749fb512236f647eedc82a88bcdb13968627f3471b0f1a67f9e5a8c13080d3307393d1
|
7
|
+
data.tar.gz: '080c80a34f7c5f8dc1c235c3ebaa28f98ba97566776749de51ca9e4e6e795d2da21e19270d66d34b3633679233c8553237f012eb1b250224f75855584399e2da'
|
@@ -9,7 +9,7 @@ module ActsAsTenant
|
|
9
9
|
ActsAsTenant.add_global_record_model(self) if options[:has_global_records]
|
10
10
|
|
11
11
|
# Create the association
|
12
|
-
valid_options = options.slice(:foreign_key, :class_name, :inverse_of, :optional, :primary_key, :counter_cache)
|
12
|
+
valid_options = options.slice(:foreign_key, :class_name, :inverse_of, :optional, :primary_key, :counter_cache, :polymorphic)
|
13
13
|
fkey = valid_options[:foreign_key] || ActsAsTenant.fkey
|
14
14
|
pkey = valid_options[:primary_key] || ActsAsTenant.pkey
|
15
15
|
polymorphic_type = valid_options[:foreign_type] || ActsAsTenant.polymorphic_type
|
@@ -105,9 +105,9 @@ module ActsAsTenant
|
|
105
105
|
|
106
106
|
fkey = reflect_on_association(ActsAsTenant.tenant_klass).foreign_key
|
107
107
|
|
108
|
-
validation_args = args.
|
108
|
+
validation_args = args.deep_dup
|
109
109
|
validation_args[:scope] = if args[:scope]
|
110
|
-
Array(args[:scope])
|
110
|
+
Array(args[:scope]) + [fkey]
|
111
111
|
else
|
112
112
|
fkey
|
113
113
|
end
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module ActsAsTenant::Sidekiq
|
2
|
+
class BaseMiddleware
|
3
|
+
def self.sidekiq_7_and_up?
|
4
|
+
Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("7")
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
2
8
|
# Get the current tenant and store in the message to be sent to Sidekiq.
|
3
|
-
class Client
|
9
|
+
class Client < BaseMiddleware
|
10
|
+
include Sidekiq::ClientMiddleware if sidekiq_7_and_up?
|
11
|
+
|
4
12
|
def call(worker_class, msg, queue, redis_pool)
|
5
13
|
if ActsAsTenant.current_tenant.present?
|
6
14
|
msg["acts_as_tenant"] ||=
|
@@ -15,7 +23,9 @@ module ActsAsTenant::Sidekiq
|
|
15
23
|
end
|
16
24
|
|
17
25
|
# Pull the tenant out and run the current thread with it.
|
18
|
-
class Server
|
26
|
+
class Server < BaseMiddleware
|
27
|
+
include Sidekiq::ServerMiddleware if sidekiq_7_and_up?
|
28
|
+
|
19
29
|
def call(worker_class, msg, queue)
|
20
30
|
if msg.has_key?("acts_as_tenant")
|
21
31
|
account = msg["acts_as_tenant"]["class"].constantize.find msg["acts_as_tenant"]["id"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_tenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erwin Matthijssen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: request_store
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.3.
|
174
|
+
rubygems_version: 3.3.26
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Add multi-tenancy to Rails applications using a shared db strategy
|