rails_multitenant 0.16.0 → 0.18.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 695a8b94b4a25b3861271091cdd21ba92dd4c8bf6bd18d38c3b419646de1c268
|
4
|
+
data.tar.gz: 20cdce2df8969538ee33a144d8f2083e9dd81b129b1ef1220c52780564526257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c221b74528939f2ae81d3547ade6c8f7193c1d0837c4a84b50fd3d73ef536a5998c16d5ec1f4f9bda6160642aa3356def927b4150849af718b2c5a7c6fcda761
|
7
|
+
data.tar.gz: 637d3d5c728fbe5c951c6bc0342007fc28dc59a0435f9f7311037515c708796a4ad443ba9bc72f87e9874fd1d94c88152219fd1508e0b5dea1b76bb5f35333c8
|
@@ -8,6 +8,12 @@ module RailsMultitenant
|
|
8
8
|
def global_context_dependent_on(*klasses)
|
9
9
|
klasses.each { |klass| GlobalContextRegistry.send(:add_dependency, klass, self) }
|
10
10
|
end
|
11
|
+
|
12
|
+
# Registers a bi-directional dependency on another class.
|
13
|
+
def global_context_mutually_dependent_on(*klasses)
|
14
|
+
global_context_dependent_on(*klasses)
|
15
|
+
klasses.each { |klass| klass.global_context_dependent_on(self) }
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
@@ -14,6 +14,8 @@ module RailsMultitenant
|
|
14
14
|
module GlobalContextRegistry
|
15
15
|
extend self
|
16
16
|
|
17
|
+
EMPTY_ARRAY = [].freeze
|
18
|
+
|
17
19
|
# Set this global
|
18
20
|
def set(symbol, value)
|
19
21
|
globals[symbol] = value
|
@@ -88,7 +90,7 @@ module RailsMultitenant
|
|
88
90
|
# Run a block of code that disregards scoping during read queries
|
89
91
|
def with_unscoped_queries
|
90
92
|
# disabling Style/ExplicitBlockArgument for performance reasons
|
91
|
-
with_merged_registry(__use_unscoped_queries: true) do
|
93
|
+
with_merged_registry(__use_unscoped_queries: true) do
|
92
94
|
yield
|
93
95
|
end
|
94
96
|
end
|
@@ -114,11 +116,16 @@ module RailsMultitenant
|
|
114
116
|
@dependencies = {}
|
115
117
|
|
116
118
|
def add_dependency(parent, dependent)
|
117
|
-
|
119
|
+
parent = parent.respond_to?(:name) ? parent.name : parent
|
120
|
+
dependent = dependent.respond_to?(:name) ? dependent.name : dependent
|
121
|
+
|
122
|
+
raise 'dependencies cannot be registered for anonymous classes' if parent.blank? || dependent.blank?
|
123
|
+
|
124
|
+
((@dependencies[parent] ||= []) << dependent).tap(&:uniq!)
|
118
125
|
end
|
119
126
|
|
120
127
|
def dependencies_for(klass)
|
121
|
-
@dependencies[klass] ||
|
128
|
+
@dependencies[klass.name]&.map(&:safe_constantize)&.tap(&:compact!) || EMPTY_ARRAY
|
122
129
|
end
|
123
130
|
|
124
131
|
def globals
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_multitenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Breault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 3.
|
115
|
+
version: 3.11.0
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 3.
|
122
|
+
version: 3.11.0
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: rspec_junit_formatter
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,14 +140,14 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: 1.
|
143
|
+
version: 1.27.1
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: 1.
|
150
|
+
version: 1.27.1
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: simplecov
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,14 +168,14 @@ dependencies:
|
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: 1.
|
171
|
+
version: 1.6.0
|
172
172
|
type: :development
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: 1.
|
178
|
+
version: 1.6.0
|
179
179
|
description: Handles multiple tenants in a Rails environment
|
180
180
|
email:
|
181
181
|
- pbreault@salsify.com
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
- !ruby/object:Gem::Version
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
|
-
rubygems_version: 3.
|
219
|
+
rubygems_version: 3.3.26
|
220
220
|
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: Automatically configures multiple tenants in a Rails environment
|