rails_multitenant 0.18.0 → 0.18.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3336c472e8e9f781be0c82a83859dd33c9566a4753c590a8527804974384a5ce
|
4
|
+
data.tar.gz: 9963126e661148092ec99d18a431b6049ddbb2cc8448bd10503bea2765567750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 443db952a9e4b0d8769eac2a58d7b004fba3391fdc08ff1883a5a05c37a43fbebc1237c78c16c104aad8da67c896e9ac253073a8627b9c13a129d092d0d21995
|
7
|
+
data.tar.gz: ee3d3bbb473467c6d49a8c7b388a1e6eb236a4b5cad84753a88eecb0786896039478b91a68b2cba07deb04eaefa3848464bf4385d36fa996271ce2c50d27a9bd
|
@@ -34,8 +34,9 @@ module RailsMultitenant
|
|
34
34
|
current || raise("No current #{name} set")
|
35
35
|
end
|
36
36
|
|
37
|
-
def clear_current!
|
37
|
+
def clear_current!(cleared = nil)
|
38
38
|
GlobalContextRegistry.delete(current_registry_obj)
|
39
|
+
__clear_dependents!(cleared)
|
39
40
|
end
|
40
41
|
|
41
42
|
def as_current(object)
|
@@ -73,8 +74,13 @@ module RailsMultitenant
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
def __clear_dependents!
|
77
|
-
GlobalContextRegistry.send(:dependencies_for, __key_class).
|
77
|
+
def __clear_dependents!(initial_cleared = nil)
|
78
|
+
GlobalContextRegistry.send(:dependencies_for, __key_class).tap do |dependencies|
|
79
|
+
next unless dependencies.present?
|
80
|
+
|
81
|
+
(cleared = initial_cleared || []) << self
|
82
|
+
dependencies.each { |obj| obj.clear_current!(cleared) unless cleared.include?(obj) }
|
83
|
+
end
|
78
84
|
end
|
79
85
|
|
80
86
|
def __key_class
|
@@ -60,15 +60,22 @@ module RailsMultitenant
|
|
60
60
|
self.current = old_model
|
61
61
|
end
|
62
62
|
|
63
|
-
def clear_current!
|
63
|
+
def clear_current!(cleared = nil)
|
64
64
|
GlobalContextRegistry.delete(current_instance_registry_obj)
|
65
|
+
__clear_dependents!(cleared)
|
65
66
|
end
|
66
67
|
|
67
68
|
private
|
68
69
|
|
69
|
-
def __clear_dependents!
|
70
|
+
def __clear_dependents!(initial_cleared = nil)
|
70
71
|
key_class = respond_to?(:base_class) ? base_class : self
|
71
|
-
|
72
|
+
|
73
|
+
GlobalContextRegistry.send(:dependencies_for, key_class).tap do |dependencies|
|
74
|
+
next unless dependencies.present?
|
75
|
+
|
76
|
+
(cleared = initial_cleared || []) << self
|
77
|
+
dependencies.each { |obj| obj.clear_current!(cleared) unless cleared.include?(obj) }
|
78
|
+
end
|
72
79
|
end
|
73
80
|
|
74
81
|
def current_instance_registry_id
|
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.18.
|
4
|
+
version: 0.18.1
|
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-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|