rails_multitenant 0.17.0 → 0.18.0
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
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
|
@@ -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: 2023-
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -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.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
|