activerecord-multi-tenant 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 +4 -4
- data/.travis.yml +2 -0
- data/Appraisals +8 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +65 -63
- data/gemfiles/active_record_5.2.gemfile.lock +4 -4
- data/gemfiles/active_record_6.0.gemfile.lock +6 -6
- data/gemfiles/active_record_6.1.gemfile +8 -0
- data/gemfiles/active_record_6.1.gemfile.lock +198 -0
- data/gemfiles/rails_5.2.gemfile.lock +1 -1
- data/gemfiles/rails_6.0.gemfile.lock +1 -1
- data/gemfiles/rails_6.1.gemfile +8 -0
- data/gemfiles/rails_6.1.gemfile.lock +198 -0
- data/lib/activerecord-multi-tenant/arel_visitors_depth_first.rb +200 -0
- data/lib/activerecord-multi-tenant/model_extensions.rb +6 -0
- data/lib/activerecord-multi-tenant/query_rewriter.rb +3 -1
- data/lib/activerecord-multi-tenant/version.rb +1 -1
- data/spec/activerecord-multi-tenant/model_extensions_spec.rb +2 -2
- data/spec/activerecord-multi-tenant/record_finding_spec.rb +36 -0
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79f35cfc24d053c192a889fcb387c764cf2580e350aa8c7db5ff4ea84d3c44df
|
4
|
+
data.tar.gz: 04bb2200ae11168efe55090482686b00e457f267696d110fec5669ae1e2c70fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b807cc7064efd06487fa8995f49cfbfdc7b15e5ccbc1e84510e0c742d6b14f8e7168145e6a520c8ea613735621b799dc6478ed8a749db68c7020ebe936b73b1
|
7
|
+
data.tar.gz: 4e8aca6b32a413a54ecc900dc6e36ee57f06faf88504d4c4b210153456b5090aa8a2a660555c1587d1c1a06ae0126db3002e0cba0d0d935f0688f7bc84c9c362
|
data/.travis.yml
CHANGED
@@ -11,8 +11,10 @@ rvm:
|
|
11
11
|
gemfile:
|
12
12
|
- gemfiles/rails_5.2.gemfile
|
13
13
|
- gemfiles/rails_6.0.gemfile
|
14
|
+
- gemfiles/rails_6.1.gemfile
|
14
15
|
- gemfiles/active_record_5.2.gemfile
|
15
16
|
- gemfiles/active_record_6.0.gemfile
|
17
|
+
- gemfiles/active_record_6.1.gemfile
|
16
18
|
|
17
19
|
env:
|
18
20
|
- PREPARED_STATEMENTS=0
|
data/Appraisals
CHANGED
@@ -14,6 +14,10 @@ appraise 'rails-6.0' do
|
|
14
14
|
gem 'rails', '~> 6.0.3'
|
15
15
|
end
|
16
16
|
|
17
|
+
appraise 'rails-6.1' do
|
18
|
+
gem 'rails', '~> 6.1.0'
|
19
|
+
end
|
20
|
+
|
17
21
|
appraise 'active-record-5.2' do
|
18
22
|
gem 'activerecord', '~> 5.2.0'
|
19
23
|
gem 'i18n', '~> 0.9.5'
|
@@ -29,3 +33,7 @@ end
|
|
29
33
|
appraise 'active-record-6.0' do
|
30
34
|
gem 'activerecord', '~> 6.0.3'
|
31
35
|
end
|
36
|
+
|
37
|
+
appraise 'active-record-6.1' do
|
38
|
+
gem 'activerecord', '~> 6.1.0'
|
39
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.1.1 2021-01-15
|
4
|
+
|
5
|
+
* Add support for Rails 6.1 [#108](https://github.com/citusdata/activerecord-multi-tenant/pull/108)
|
6
|
+
* Fix statement cache for has_many through relations [#103](https://github.com/citusdata/activerecord-multi-tenant/pull/103)
|
7
|
+
|
8
|
+
|
9
|
+
## 1.1.0 2020-08-06
|
10
|
+
|
11
|
+
* See commits for changes:
|
12
|
+
https://github.com/citusdata/activerecord-multi-tenant/commits/v1.1.0
|
13
|
+
|
3
14
|
|
4
15
|
## 1.0.4 2019-10-30
|
5
16
|
|
data/Gemfile.lock
CHANGED
@@ -1,63 +1,63 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-multi-tenant (1.1.
|
4
|
+
activerecord-multi-tenant (1.1.1)
|
5
5
|
rails (>= 4.2)
|
6
6
|
request_store (>= 1.0.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.0.3.
|
12
|
-
actionpack (= 6.0.3.
|
11
|
+
actioncable (6.0.3.3)
|
12
|
+
actionpack (= 6.0.3.3)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.0.3.
|
16
|
-
actionpack (= 6.0.3.
|
17
|
-
activejob (= 6.0.3.
|
18
|
-
activerecord (= 6.0.3.
|
19
|
-
activestorage (= 6.0.3.
|
20
|
-
activesupport (= 6.0.3.
|
15
|
+
actionmailbox (6.0.3.3)
|
16
|
+
actionpack (= 6.0.3.3)
|
17
|
+
activejob (= 6.0.3.3)
|
18
|
+
activerecord (= 6.0.3.3)
|
19
|
+
activestorage (= 6.0.3.3)
|
20
|
+
activesupport (= 6.0.3.3)
|
21
21
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.0.3.
|
23
|
-
actionpack (= 6.0.3.
|
24
|
-
actionview (= 6.0.3.
|
25
|
-
activejob (= 6.0.3.
|
22
|
+
actionmailer (6.0.3.3)
|
23
|
+
actionpack (= 6.0.3.3)
|
24
|
+
actionview (= 6.0.3.3)
|
25
|
+
activejob (= 6.0.3.3)
|
26
26
|
mail (~> 2.5, >= 2.5.4)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.0.3.
|
29
|
-
actionview (= 6.0.3.
|
30
|
-
activesupport (= 6.0.3.
|
28
|
+
actionpack (6.0.3.3)
|
29
|
+
actionview (= 6.0.3.3)
|
30
|
+
activesupport (= 6.0.3.3)
|
31
31
|
rack (~> 2.0, >= 2.0.8)
|
32
32
|
rack-test (>= 0.6.3)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
34
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.0.3.
|
36
|
-
actionpack (= 6.0.3.
|
37
|
-
activerecord (= 6.0.3.
|
38
|
-
activestorage (= 6.0.3.
|
39
|
-
activesupport (= 6.0.3.
|
35
|
+
actiontext (6.0.3.3)
|
36
|
+
actionpack (= 6.0.3.3)
|
37
|
+
activerecord (= 6.0.3.3)
|
38
|
+
activestorage (= 6.0.3.3)
|
39
|
+
activesupport (= 6.0.3.3)
|
40
40
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.0.3.
|
42
|
-
activesupport (= 6.0.3.
|
41
|
+
actionview (6.0.3.3)
|
42
|
+
activesupport (= 6.0.3.3)
|
43
43
|
builder (~> 3.1)
|
44
44
|
erubi (~> 1.4)
|
45
45
|
rails-dom-testing (~> 2.0)
|
46
46
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.0.3.
|
48
|
-
activesupport (= 6.0.3.
|
47
|
+
activejob (6.0.3.3)
|
48
|
+
activesupport (= 6.0.3.3)
|
49
49
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.0.3.
|
51
|
-
activesupport (= 6.0.3.
|
52
|
-
activerecord (6.0.3.
|
53
|
-
activemodel (= 6.0.3.
|
54
|
-
activesupport (= 6.0.3.
|
55
|
-
activestorage (6.0.3.
|
56
|
-
actionpack (= 6.0.3.
|
57
|
-
activejob (= 6.0.3.
|
58
|
-
activerecord (= 6.0.3.
|
50
|
+
activemodel (6.0.3.3)
|
51
|
+
activesupport (= 6.0.3.3)
|
52
|
+
activerecord (6.0.3.3)
|
53
|
+
activemodel (= 6.0.3.3)
|
54
|
+
activesupport (= 6.0.3.3)
|
55
|
+
activestorage (6.0.3.3)
|
56
|
+
actionpack (= 6.0.3.3)
|
57
|
+
activejob (= 6.0.3.3)
|
58
|
+
activerecord (= 6.0.3.3)
|
59
59
|
marcel (~> 0.3.1)
|
60
|
-
activesupport (6.0.3.
|
60
|
+
activesupport (6.0.3.3)
|
61
61
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
62
|
i18n (>= 0.7, < 2)
|
63
63
|
minitest (~> 5.1)
|
@@ -70,16 +70,16 @@ GEM
|
|
70
70
|
builder (3.2.4)
|
71
71
|
byebug (11.0.1)
|
72
72
|
coderay (1.1.2)
|
73
|
-
concurrent-ruby (1.1.
|
73
|
+
concurrent-ruby (1.1.7)
|
74
74
|
connection_pool (2.2.2)
|
75
75
|
crass (1.0.6)
|
76
76
|
diff-lcs (1.3)
|
77
77
|
erubi (1.9.0)
|
78
78
|
globalid (0.4.2)
|
79
79
|
activesupport (>= 4.2.0)
|
80
|
-
i18n (1.8.
|
80
|
+
i18n (1.8.5)
|
81
81
|
concurrent-ruby (~> 1.0)
|
82
|
-
loofah (2.
|
82
|
+
loofah (2.7.0)
|
83
83
|
crass (~> 1.0.2)
|
84
84
|
nokogiri (>= 1.5.9)
|
85
85
|
mail (2.7.1)
|
@@ -89,11 +89,12 @@ GEM
|
|
89
89
|
method_source (0.9.2)
|
90
90
|
mimemagic (0.3.5)
|
91
91
|
mini_mime (1.0.2)
|
92
|
-
mini_portile2 (2.
|
93
|
-
minitest (5.14.
|
94
|
-
nio4r (2.5.
|
95
|
-
nokogiri (1.
|
96
|
-
mini_portile2 (~> 2.
|
92
|
+
mini_portile2 (2.5.0)
|
93
|
+
minitest (5.14.2)
|
94
|
+
nio4r (2.5.4)
|
95
|
+
nokogiri (1.11.1)
|
96
|
+
mini_portile2 (~> 2.5.0)
|
97
|
+
racc (~> 1.4)
|
97
98
|
pg (1.1.4)
|
98
99
|
pry (0.12.2)
|
99
100
|
coderay (~> 1.1.0)
|
@@ -101,40 +102,41 @@ GEM
|
|
101
102
|
pry-byebug (3.7.0)
|
102
103
|
byebug (~> 11.0)
|
103
104
|
pry (~> 0.10)
|
105
|
+
racc (1.5.2)
|
104
106
|
rack (2.2.3)
|
105
107
|
rack-protection (2.0.5)
|
106
108
|
rack
|
107
109
|
rack-test (1.1.0)
|
108
110
|
rack (>= 1.0, < 3)
|
109
|
-
rails (6.0.3.
|
110
|
-
actioncable (= 6.0.3.
|
111
|
-
actionmailbox (= 6.0.3.
|
112
|
-
actionmailer (= 6.0.3.
|
113
|
-
actionpack (= 6.0.3.
|
114
|
-
actiontext (= 6.0.3.
|
115
|
-
actionview (= 6.0.3.
|
116
|
-
activejob (= 6.0.3.
|
117
|
-
activemodel (= 6.0.3.
|
118
|
-
activerecord (= 6.0.3.
|
119
|
-
activestorage (= 6.0.3.
|
120
|
-
activesupport (= 6.0.3.
|
111
|
+
rails (6.0.3.3)
|
112
|
+
actioncable (= 6.0.3.3)
|
113
|
+
actionmailbox (= 6.0.3.3)
|
114
|
+
actionmailer (= 6.0.3.3)
|
115
|
+
actionpack (= 6.0.3.3)
|
116
|
+
actiontext (= 6.0.3.3)
|
117
|
+
actionview (= 6.0.3.3)
|
118
|
+
activejob (= 6.0.3.3)
|
119
|
+
activemodel (= 6.0.3.3)
|
120
|
+
activerecord (= 6.0.3.3)
|
121
|
+
activestorage (= 6.0.3.3)
|
122
|
+
activesupport (= 6.0.3.3)
|
121
123
|
bundler (>= 1.3.0)
|
122
|
-
railties (= 6.0.3.
|
124
|
+
railties (= 6.0.3.3)
|
123
125
|
sprockets-rails (>= 2.0.0)
|
124
126
|
rails-dom-testing (2.0.3)
|
125
127
|
activesupport (>= 4.2.0)
|
126
128
|
nokogiri (>= 1.6)
|
127
129
|
rails-html-sanitizer (1.3.0)
|
128
130
|
loofah (~> 2.3)
|
129
|
-
railties (6.0.3.
|
130
|
-
actionpack (= 6.0.3.
|
131
|
-
activesupport (= 6.0.3.
|
131
|
+
railties (6.0.3.3)
|
132
|
+
actionpack (= 6.0.3.3)
|
133
|
+
activesupport (= 6.0.3.3)
|
132
134
|
method_source
|
133
135
|
rake (>= 0.8.7)
|
134
136
|
thor (>= 0.20.3, < 2.0)
|
135
137
|
rake (13.0.1)
|
136
138
|
redis (4.1.2)
|
137
|
-
request_store (1.
|
139
|
+
request_store (1.5.0)
|
138
140
|
rack (>= 1.4)
|
139
141
|
rspec (3.8.0)
|
140
142
|
rspec-core (~> 3.8.0)
|
@@ -165,7 +167,7 @@ GEM
|
|
165
167
|
sprockets (4.0.2)
|
166
168
|
concurrent-ruby (~> 1.0)
|
167
169
|
rack (> 1, < 3)
|
168
|
-
sprockets-rails (3.2.
|
170
|
+
sprockets-rails (3.2.2)
|
169
171
|
actionpack (>= 4.0)
|
170
172
|
activesupport (>= 4.0)
|
171
173
|
sprockets (>= 3.0.0)
|
@@ -173,10 +175,10 @@ GEM
|
|
173
175
|
thread_safe (0.3.6)
|
174
176
|
tzinfo (1.2.7)
|
175
177
|
thread_safe (~> 0.1)
|
176
|
-
websocket-driver (0.7.
|
178
|
+
websocket-driver (0.7.3)
|
177
179
|
websocket-extensions (>= 0.1.0)
|
178
180
|
websocket-extensions (0.1.5)
|
179
|
-
zeitwerk (2.
|
181
|
+
zeitwerk (2.4.0)
|
180
182
|
|
181
183
|
PLATFORMS
|
182
184
|
ruby
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
activerecord-multi-tenant (1.1.
|
4
|
+
activerecord-multi-tenant (1.1.1)
|
5
5
|
rails (>= 4.2)
|
6
6
|
request_store (>= 1.0.5)
|
7
7
|
|
@@ -150,7 +150,7 @@ GEM
|
|
150
150
|
sprockets (3.7.2)
|
151
151
|
concurrent-ruby (~> 1.0)
|
152
152
|
rack (> 1, < 3)
|
153
|
-
sprockets-rails (3.2.
|
153
|
+
sprockets-rails (3.2.2)
|
154
154
|
actionpack (>= 4.0)
|
155
155
|
activesupport (>= 4.0)
|
156
156
|
sprockets (>= 3.0.0)
|
@@ -158,9 +158,9 @@ GEM
|
|
158
158
|
thread_safe (0.3.6)
|
159
159
|
tzinfo (1.2.7)
|
160
160
|
thread_safe (~> 0.1)
|
161
|
-
websocket-driver (0.7.
|
161
|
+
websocket-driver (0.7.3)
|
162
162
|
websocket-extensions (>= 0.1.0)
|
163
|
-
websocket-extensions (0.1.
|
163
|
+
websocket-extensions (0.1.5)
|
164
164
|
|
165
165
|
PLATFORMS
|
166
166
|
ruby
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
activerecord-multi-tenant (1.1.
|
4
|
+
activerecord-multi-tenant (1.1.1)
|
5
5
|
rails (>= 4.2)
|
6
6
|
request_store (>= 1.0.5)
|
7
7
|
|
@@ -91,7 +91,7 @@ GEM
|
|
91
91
|
mini_mime (1.0.2)
|
92
92
|
mini_portile2 (2.4.0)
|
93
93
|
minitest (5.14.1)
|
94
|
-
nio4r (2.5.
|
94
|
+
nio4r (2.5.4)
|
95
95
|
nokogiri (1.10.9)
|
96
96
|
mini_portile2 (~> 2.4.0)
|
97
97
|
pg (1.2.3)
|
@@ -162,10 +162,10 @@ GEM
|
|
162
162
|
rack (~> 2.0)
|
163
163
|
rack-protection (>= 2.0.0)
|
164
164
|
redis (>= 4.1.0)
|
165
|
-
sprockets (4.0.
|
165
|
+
sprockets (4.0.2)
|
166
166
|
concurrent-ruby (~> 1.0)
|
167
167
|
rack (> 1, < 3)
|
168
|
-
sprockets-rails (3.2.
|
168
|
+
sprockets-rails (3.2.2)
|
169
169
|
actionpack (>= 4.0)
|
170
170
|
activesupport (>= 4.0)
|
171
171
|
sprockets (>= 3.0.0)
|
@@ -173,9 +173,9 @@ GEM
|
|
173
173
|
thread_safe (0.3.6)
|
174
174
|
tzinfo (1.2.7)
|
175
175
|
thread_safe (~> 0.1)
|
176
|
-
websocket-driver (0.7.
|
176
|
+
websocket-driver (0.7.3)
|
177
177
|
websocket-extensions (>= 0.1.0)
|
178
|
-
websocket-extensions (0.1.
|
178
|
+
websocket-extensions (0.1.5)
|
179
179
|
zeitwerk (2.3.0)
|
180
180
|
|
181
181
|
PLATFORMS
|
@@ -0,0 +1,198 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activerecord-multi-tenant (1.1.1)
|
5
|
+
rails (>= 4.2)
|
6
|
+
request_store (>= 1.0.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (6.1.0)
|
12
|
+
actionpack (= 6.1.0)
|
13
|
+
activesupport (= 6.1.0)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (6.1.0)
|
17
|
+
actionpack (= 6.1.0)
|
18
|
+
activejob (= 6.1.0)
|
19
|
+
activerecord (= 6.1.0)
|
20
|
+
activestorage (= 6.1.0)
|
21
|
+
activesupport (= 6.1.0)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
actionmailer (6.1.0)
|
24
|
+
actionpack (= 6.1.0)
|
25
|
+
actionview (= 6.1.0)
|
26
|
+
activejob (= 6.1.0)
|
27
|
+
activesupport (= 6.1.0)
|
28
|
+
mail (~> 2.5, >= 2.5.4)
|
29
|
+
rails-dom-testing (~> 2.0)
|
30
|
+
actionpack (6.1.0)
|
31
|
+
actionview (= 6.1.0)
|
32
|
+
activesupport (= 6.1.0)
|
33
|
+
rack (~> 2.0, >= 2.0.9)
|
34
|
+
rack-test (>= 0.6.3)
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
+
actiontext (6.1.0)
|
38
|
+
actionpack (= 6.1.0)
|
39
|
+
activerecord (= 6.1.0)
|
40
|
+
activestorage (= 6.1.0)
|
41
|
+
activesupport (= 6.1.0)
|
42
|
+
nokogiri (>= 1.8.5)
|
43
|
+
actionview (6.1.0)
|
44
|
+
activesupport (= 6.1.0)
|
45
|
+
builder (~> 3.1)
|
46
|
+
erubi (~> 1.4)
|
47
|
+
rails-dom-testing (~> 2.0)
|
48
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
+
activejob (6.1.0)
|
50
|
+
activesupport (= 6.1.0)
|
51
|
+
globalid (>= 0.3.6)
|
52
|
+
activemodel (6.1.0)
|
53
|
+
activesupport (= 6.1.0)
|
54
|
+
activerecord (6.1.0)
|
55
|
+
activemodel (= 6.1.0)
|
56
|
+
activesupport (= 6.1.0)
|
57
|
+
activestorage (6.1.0)
|
58
|
+
actionpack (= 6.1.0)
|
59
|
+
activejob (= 6.1.0)
|
60
|
+
activerecord (= 6.1.0)
|
61
|
+
activesupport (= 6.1.0)
|
62
|
+
marcel (~> 0.3.1)
|
63
|
+
mimemagic (~> 0.3.2)
|
64
|
+
activesupport (6.1.0)
|
65
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
|
+
i18n (>= 1.6, < 2)
|
67
|
+
minitest (>= 5.1)
|
68
|
+
tzinfo (~> 2.0)
|
69
|
+
zeitwerk (~> 2.3)
|
70
|
+
appraisal (2.3.0)
|
71
|
+
bundler
|
72
|
+
rake
|
73
|
+
thor (>= 0.14.0)
|
74
|
+
builder (3.2.4)
|
75
|
+
byebug (11.1.3)
|
76
|
+
coderay (1.1.3)
|
77
|
+
concurrent-ruby (1.1.7)
|
78
|
+
connection_pool (2.2.3)
|
79
|
+
crass (1.0.6)
|
80
|
+
diff-lcs (1.4.4)
|
81
|
+
erubi (1.10.0)
|
82
|
+
globalid (0.4.2)
|
83
|
+
activesupport (>= 4.2.0)
|
84
|
+
i18n (1.8.5)
|
85
|
+
concurrent-ruby (~> 1.0)
|
86
|
+
loofah (2.8.0)
|
87
|
+
crass (~> 1.0.2)
|
88
|
+
nokogiri (>= 1.5.9)
|
89
|
+
mail (2.7.1)
|
90
|
+
mini_mime (>= 0.1.1)
|
91
|
+
marcel (0.3.3)
|
92
|
+
mimemagic (~> 0.3.2)
|
93
|
+
method_source (1.0.0)
|
94
|
+
mimemagic (0.3.5)
|
95
|
+
mini_mime (1.0.2)
|
96
|
+
mini_portile2 (2.4.0)
|
97
|
+
minitest (5.14.2)
|
98
|
+
nio4r (2.5.4)
|
99
|
+
nokogiri (1.10.10)
|
100
|
+
mini_portile2 (~> 2.4.0)
|
101
|
+
pg (1.2.3)
|
102
|
+
pry (0.13.1)
|
103
|
+
coderay (~> 1.1)
|
104
|
+
method_source (~> 1.0)
|
105
|
+
pry-byebug (3.9.0)
|
106
|
+
byebug (~> 11.0)
|
107
|
+
pry (~> 0.13.0)
|
108
|
+
rack (2.2.3)
|
109
|
+
rack-test (1.1.0)
|
110
|
+
rack (>= 1.0, < 3)
|
111
|
+
rails (6.1.0)
|
112
|
+
actioncable (= 6.1.0)
|
113
|
+
actionmailbox (= 6.1.0)
|
114
|
+
actionmailer (= 6.1.0)
|
115
|
+
actionpack (= 6.1.0)
|
116
|
+
actiontext (= 6.1.0)
|
117
|
+
actionview (= 6.1.0)
|
118
|
+
activejob (= 6.1.0)
|
119
|
+
activemodel (= 6.1.0)
|
120
|
+
activerecord (= 6.1.0)
|
121
|
+
activestorage (= 6.1.0)
|
122
|
+
activesupport (= 6.1.0)
|
123
|
+
bundler (>= 1.15.0)
|
124
|
+
railties (= 6.1.0)
|
125
|
+
sprockets-rails (>= 2.0.0)
|
126
|
+
rails-dom-testing (2.0.3)
|
127
|
+
activesupport (>= 4.2.0)
|
128
|
+
nokogiri (>= 1.6)
|
129
|
+
rails-html-sanitizer (1.3.0)
|
130
|
+
loofah (~> 2.3)
|
131
|
+
railties (6.1.0)
|
132
|
+
actionpack (= 6.1.0)
|
133
|
+
activesupport (= 6.1.0)
|
134
|
+
method_source
|
135
|
+
rake (>= 0.8.7)
|
136
|
+
thor (~> 1.0)
|
137
|
+
rake (13.0.3)
|
138
|
+
redis (4.2.5)
|
139
|
+
request_store (1.5.0)
|
140
|
+
rack (>= 1.4)
|
141
|
+
rspec (3.10.0)
|
142
|
+
rspec-core (~> 3.10.0)
|
143
|
+
rspec-expectations (~> 3.10.0)
|
144
|
+
rspec-mocks (~> 3.10.0)
|
145
|
+
rspec-core (3.10.1)
|
146
|
+
rspec-support (~> 3.10.0)
|
147
|
+
rspec-expectations (3.10.1)
|
148
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
149
|
+
rspec-support (~> 3.10.0)
|
150
|
+
rspec-mocks (3.10.1)
|
151
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
152
|
+
rspec-support (~> 3.10.0)
|
153
|
+
rspec-rails (4.0.2)
|
154
|
+
actionpack (>= 4.2)
|
155
|
+
activesupport (>= 4.2)
|
156
|
+
railties (>= 4.2)
|
157
|
+
rspec-core (~> 3.10)
|
158
|
+
rspec-expectations (~> 3.10)
|
159
|
+
rspec-mocks (~> 3.10)
|
160
|
+
rspec-support (~> 3.10)
|
161
|
+
rspec-support (3.10.1)
|
162
|
+
sidekiq (6.1.2)
|
163
|
+
connection_pool (>= 2.2.2)
|
164
|
+
rack (~> 2.0)
|
165
|
+
redis (>= 4.2.0)
|
166
|
+
sprockets (4.0.2)
|
167
|
+
concurrent-ruby (~> 1.0)
|
168
|
+
rack (> 1, < 3)
|
169
|
+
sprockets-rails (3.2.2)
|
170
|
+
actionpack (>= 4.0)
|
171
|
+
activesupport (>= 4.0)
|
172
|
+
sprockets (>= 3.0.0)
|
173
|
+
thor (1.0.1)
|
174
|
+
tzinfo (2.0.4)
|
175
|
+
concurrent-ruby (~> 1.0)
|
176
|
+
websocket-driver (0.7.3)
|
177
|
+
websocket-extensions (>= 0.1.0)
|
178
|
+
websocket-extensions (0.1.5)
|
179
|
+
zeitwerk (2.4.2)
|
180
|
+
|
181
|
+
PLATFORMS
|
182
|
+
ruby
|
183
|
+
|
184
|
+
DEPENDENCIES
|
185
|
+
activerecord (~> 6.1.0)
|
186
|
+
activerecord-multi-tenant!
|
187
|
+
appraisal
|
188
|
+
pg
|
189
|
+
pry
|
190
|
+
pry-byebug
|
191
|
+
rake
|
192
|
+
rspec (>= 3.0)
|
193
|
+
rspec-rails
|
194
|
+
sidekiq
|
195
|
+
thor
|
196
|
+
|
197
|
+
BUNDLED WITH
|
198
|
+
2.1.4
|
@@ -0,0 +1,198 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activerecord-multi-tenant (1.1.1)
|
5
|
+
rails (>= 4.2)
|
6
|
+
request_store (>= 1.0.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (6.1.0)
|
12
|
+
actionpack (= 6.1.0)
|
13
|
+
activesupport (= 6.1.0)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (6.1.0)
|
17
|
+
actionpack (= 6.1.0)
|
18
|
+
activejob (= 6.1.0)
|
19
|
+
activerecord (= 6.1.0)
|
20
|
+
activestorage (= 6.1.0)
|
21
|
+
activesupport (= 6.1.0)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
actionmailer (6.1.0)
|
24
|
+
actionpack (= 6.1.0)
|
25
|
+
actionview (= 6.1.0)
|
26
|
+
activejob (= 6.1.0)
|
27
|
+
activesupport (= 6.1.0)
|
28
|
+
mail (~> 2.5, >= 2.5.4)
|
29
|
+
rails-dom-testing (~> 2.0)
|
30
|
+
actionpack (6.1.0)
|
31
|
+
actionview (= 6.1.0)
|
32
|
+
activesupport (= 6.1.0)
|
33
|
+
rack (~> 2.0, >= 2.0.9)
|
34
|
+
rack-test (>= 0.6.3)
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
+
actiontext (6.1.0)
|
38
|
+
actionpack (= 6.1.0)
|
39
|
+
activerecord (= 6.1.0)
|
40
|
+
activestorage (= 6.1.0)
|
41
|
+
activesupport (= 6.1.0)
|
42
|
+
nokogiri (>= 1.8.5)
|
43
|
+
actionview (6.1.0)
|
44
|
+
activesupport (= 6.1.0)
|
45
|
+
builder (~> 3.1)
|
46
|
+
erubi (~> 1.4)
|
47
|
+
rails-dom-testing (~> 2.0)
|
48
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
+
activejob (6.1.0)
|
50
|
+
activesupport (= 6.1.0)
|
51
|
+
globalid (>= 0.3.6)
|
52
|
+
activemodel (6.1.0)
|
53
|
+
activesupport (= 6.1.0)
|
54
|
+
activerecord (6.1.0)
|
55
|
+
activemodel (= 6.1.0)
|
56
|
+
activesupport (= 6.1.0)
|
57
|
+
activestorage (6.1.0)
|
58
|
+
actionpack (= 6.1.0)
|
59
|
+
activejob (= 6.1.0)
|
60
|
+
activerecord (= 6.1.0)
|
61
|
+
activesupport (= 6.1.0)
|
62
|
+
marcel (~> 0.3.1)
|
63
|
+
mimemagic (~> 0.3.2)
|
64
|
+
activesupport (6.1.0)
|
65
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
|
+
i18n (>= 1.6, < 2)
|
67
|
+
minitest (>= 5.1)
|
68
|
+
tzinfo (~> 2.0)
|
69
|
+
zeitwerk (~> 2.3)
|
70
|
+
appraisal (2.3.0)
|
71
|
+
bundler
|
72
|
+
rake
|
73
|
+
thor (>= 0.14.0)
|
74
|
+
builder (3.2.4)
|
75
|
+
byebug (11.1.3)
|
76
|
+
coderay (1.1.3)
|
77
|
+
concurrent-ruby (1.1.7)
|
78
|
+
connection_pool (2.2.3)
|
79
|
+
crass (1.0.6)
|
80
|
+
diff-lcs (1.4.4)
|
81
|
+
erubi (1.10.0)
|
82
|
+
globalid (0.4.2)
|
83
|
+
activesupport (>= 4.2.0)
|
84
|
+
i18n (1.8.5)
|
85
|
+
concurrent-ruby (~> 1.0)
|
86
|
+
loofah (2.8.0)
|
87
|
+
crass (~> 1.0.2)
|
88
|
+
nokogiri (>= 1.5.9)
|
89
|
+
mail (2.7.1)
|
90
|
+
mini_mime (>= 0.1.1)
|
91
|
+
marcel (0.3.3)
|
92
|
+
mimemagic (~> 0.3.2)
|
93
|
+
method_source (1.0.0)
|
94
|
+
mimemagic (0.3.5)
|
95
|
+
mini_mime (1.0.2)
|
96
|
+
mini_portile2 (2.4.0)
|
97
|
+
minitest (5.14.2)
|
98
|
+
nio4r (2.5.4)
|
99
|
+
nokogiri (1.10.10)
|
100
|
+
mini_portile2 (~> 2.4.0)
|
101
|
+
pg (1.2.3)
|
102
|
+
pry (0.13.1)
|
103
|
+
coderay (~> 1.1)
|
104
|
+
method_source (~> 1.0)
|
105
|
+
pry-byebug (3.9.0)
|
106
|
+
byebug (~> 11.0)
|
107
|
+
pry (~> 0.13.0)
|
108
|
+
rack (2.2.3)
|
109
|
+
rack-test (1.1.0)
|
110
|
+
rack (>= 1.0, < 3)
|
111
|
+
rails (6.1.0)
|
112
|
+
actioncable (= 6.1.0)
|
113
|
+
actionmailbox (= 6.1.0)
|
114
|
+
actionmailer (= 6.1.0)
|
115
|
+
actionpack (= 6.1.0)
|
116
|
+
actiontext (= 6.1.0)
|
117
|
+
actionview (= 6.1.0)
|
118
|
+
activejob (= 6.1.0)
|
119
|
+
activemodel (= 6.1.0)
|
120
|
+
activerecord (= 6.1.0)
|
121
|
+
activestorage (= 6.1.0)
|
122
|
+
activesupport (= 6.1.0)
|
123
|
+
bundler (>= 1.15.0)
|
124
|
+
railties (= 6.1.0)
|
125
|
+
sprockets-rails (>= 2.0.0)
|
126
|
+
rails-dom-testing (2.0.3)
|
127
|
+
activesupport (>= 4.2.0)
|
128
|
+
nokogiri (>= 1.6)
|
129
|
+
rails-html-sanitizer (1.3.0)
|
130
|
+
loofah (~> 2.3)
|
131
|
+
railties (6.1.0)
|
132
|
+
actionpack (= 6.1.0)
|
133
|
+
activesupport (= 6.1.0)
|
134
|
+
method_source
|
135
|
+
rake (>= 0.8.7)
|
136
|
+
thor (~> 1.0)
|
137
|
+
rake (13.0.3)
|
138
|
+
redis (4.2.5)
|
139
|
+
request_store (1.5.0)
|
140
|
+
rack (>= 1.4)
|
141
|
+
rspec (3.10.0)
|
142
|
+
rspec-core (~> 3.10.0)
|
143
|
+
rspec-expectations (~> 3.10.0)
|
144
|
+
rspec-mocks (~> 3.10.0)
|
145
|
+
rspec-core (3.10.1)
|
146
|
+
rspec-support (~> 3.10.0)
|
147
|
+
rspec-expectations (3.10.1)
|
148
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
149
|
+
rspec-support (~> 3.10.0)
|
150
|
+
rspec-mocks (3.10.1)
|
151
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
152
|
+
rspec-support (~> 3.10.0)
|
153
|
+
rspec-rails (4.0.2)
|
154
|
+
actionpack (>= 4.2)
|
155
|
+
activesupport (>= 4.2)
|
156
|
+
railties (>= 4.2)
|
157
|
+
rspec-core (~> 3.10)
|
158
|
+
rspec-expectations (~> 3.10)
|
159
|
+
rspec-mocks (~> 3.10)
|
160
|
+
rspec-support (~> 3.10)
|
161
|
+
rspec-support (3.10.1)
|
162
|
+
sidekiq (6.1.2)
|
163
|
+
connection_pool (>= 2.2.2)
|
164
|
+
rack (~> 2.0)
|
165
|
+
redis (>= 4.2.0)
|
166
|
+
sprockets (4.0.2)
|
167
|
+
concurrent-ruby (~> 1.0)
|
168
|
+
rack (> 1, < 3)
|
169
|
+
sprockets-rails (3.2.2)
|
170
|
+
actionpack (>= 4.0)
|
171
|
+
activesupport (>= 4.0)
|
172
|
+
sprockets (>= 3.0.0)
|
173
|
+
thor (1.0.1)
|
174
|
+
tzinfo (2.0.4)
|
175
|
+
concurrent-ruby (~> 1.0)
|
176
|
+
websocket-driver (0.7.3)
|
177
|
+
websocket-extensions (>= 0.1.0)
|
178
|
+
websocket-extensions (0.1.5)
|
179
|
+
zeitwerk (2.4.2)
|
180
|
+
|
181
|
+
PLATFORMS
|
182
|
+
ruby
|
183
|
+
|
184
|
+
DEPENDENCIES
|
185
|
+
activerecord-multi-tenant!
|
186
|
+
appraisal
|
187
|
+
pg
|
188
|
+
pry
|
189
|
+
pry-byebug
|
190
|
+
rails (~> 6.1.0)
|
191
|
+
rake
|
192
|
+
rspec (>= 3.0)
|
193
|
+
rspec-rails
|
194
|
+
sidekiq
|
195
|
+
thor
|
196
|
+
|
197
|
+
BUNDLED WITH
|
198
|
+
2.1.4
|
@@ -0,0 +1,200 @@
|
|
1
|
+
module MultiTenant
|
2
|
+
class ArelVisitorsDepthFirst < Arel::Visitors::Visitor
|
3
|
+
def initialize(block = nil)
|
4
|
+
@block = block || Proc.new
|
5
|
+
super()
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def visit(o, _ = nil)
|
11
|
+
super
|
12
|
+
@block.call o
|
13
|
+
end
|
14
|
+
|
15
|
+
def unary(o)
|
16
|
+
visit o.expr
|
17
|
+
end
|
18
|
+
alias :visit_Arel_Nodes_Else :unary
|
19
|
+
alias :visit_Arel_Nodes_Group :unary
|
20
|
+
alias :visit_Arel_Nodes_Cube :unary
|
21
|
+
alias :visit_Arel_Nodes_RollUp :unary
|
22
|
+
alias :visit_Arel_Nodes_GroupingSet :unary
|
23
|
+
alias :visit_Arel_Nodes_GroupingElement :unary
|
24
|
+
alias :visit_Arel_Nodes_Grouping :unary
|
25
|
+
alias :visit_Arel_Nodes_Having :unary
|
26
|
+
alias :visit_Arel_Nodes_Lateral :unary
|
27
|
+
alias :visit_Arel_Nodes_Limit :unary
|
28
|
+
alias :visit_Arel_Nodes_Not :unary
|
29
|
+
alias :visit_Arel_Nodes_Offset :unary
|
30
|
+
alias :visit_Arel_Nodes_On :unary
|
31
|
+
alias :visit_Arel_Nodes_Ordering :unary
|
32
|
+
alias :visit_Arel_Nodes_Ascending :unary
|
33
|
+
alias :visit_Arel_Nodes_Descending :unary
|
34
|
+
alias :visit_Arel_Nodes_UnqualifiedColumn :unary
|
35
|
+
alias :visit_Arel_Nodes_OptimizerHints :unary
|
36
|
+
alias :visit_Arel_Nodes_ValuesList :unary
|
37
|
+
|
38
|
+
def function(o)
|
39
|
+
visit o.expressions
|
40
|
+
visit o.alias
|
41
|
+
visit o.distinct
|
42
|
+
end
|
43
|
+
alias :visit_Arel_Nodes_Avg :function
|
44
|
+
alias :visit_Arel_Nodes_Exists :function
|
45
|
+
alias :visit_Arel_Nodes_Max :function
|
46
|
+
alias :visit_Arel_Nodes_Min :function
|
47
|
+
alias :visit_Arel_Nodes_Sum :function
|
48
|
+
|
49
|
+
def visit_Arel_Nodes_NamedFunction(o)
|
50
|
+
visit o.name
|
51
|
+
visit o.expressions
|
52
|
+
visit o.distinct
|
53
|
+
visit o.alias
|
54
|
+
end
|
55
|
+
|
56
|
+
def visit_Arel_Nodes_Count(o)
|
57
|
+
visit o.expressions
|
58
|
+
visit o.alias
|
59
|
+
visit o.distinct
|
60
|
+
end
|
61
|
+
|
62
|
+
def visit_Arel_Nodes_Case(o)
|
63
|
+
visit o.case
|
64
|
+
visit o.conditions
|
65
|
+
visit o.default
|
66
|
+
end
|
67
|
+
|
68
|
+
def nary(o)
|
69
|
+
o.children.each { |child| visit child }
|
70
|
+
end
|
71
|
+
alias :visit_Arel_Nodes_And :nary
|
72
|
+
|
73
|
+
def binary(o)
|
74
|
+
visit o.left
|
75
|
+
visit o.right
|
76
|
+
end
|
77
|
+
alias :visit_Arel_Nodes_As :binary
|
78
|
+
alias :visit_Arel_Nodes_Assignment :binary
|
79
|
+
alias :visit_Arel_Nodes_Between :binary
|
80
|
+
alias :visit_Arel_Nodes_Concat :binary
|
81
|
+
alias :visit_Arel_Nodes_DeleteStatement :binary
|
82
|
+
alias :visit_Arel_Nodes_DoesNotMatch :binary
|
83
|
+
alias :visit_Arel_Nodes_Equality :binary
|
84
|
+
alias :visit_Arel_Nodes_FullOuterJoin :binary
|
85
|
+
alias :visit_Arel_Nodes_GreaterThan :binary
|
86
|
+
alias :visit_Arel_Nodes_GreaterThanOrEqual :binary
|
87
|
+
alias :visit_Arel_Nodes_In :binary
|
88
|
+
alias :visit_Arel_Nodes_InfixOperation :binary
|
89
|
+
alias :visit_Arel_Nodes_JoinSource :binary
|
90
|
+
alias :visit_Arel_Nodes_InnerJoin :binary
|
91
|
+
alias :visit_Arel_Nodes_LessThan :binary
|
92
|
+
alias :visit_Arel_Nodes_LessThanOrEqual :binary
|
93
|
+
alias :visit_Arel_Nodes_Matches :binary
|
94
|
+
alias :visit_Arel_Nodes_NotEqual :binary
|
95
|
+
alias :visit_Arel_Nodes_NotIn :binary
|
96
|
+
alias :visit_Arel_Nodes_NotRegexp :binary
|
97
|
+
alias :visit_Arel_Nodes_IsNotDistinctFrom :binary
|
98
|
+
alias :visit_Arel_Nodes_IsDistinctFrom :binary
|
99
|
+
alias :visit_Arel_Nodes_Or :binary
|
100
|
+
alias :visit_Arel_Nodes_OuterJoin :binary
|
101
|
+
alias :visit_Arel_Nodes_Regexp :binary
|
102
|
+
alias :visit_Arel_Nodes_RightOuterJoin :binary
|
103
|
+
alias :visit_Arel_Nodes_TableAlias :binary
|
104
|
+
alias :visit_Arel_Nodes_When :binary
|
105
|
+
|
106
|
+
def visit_Arel_Nodes_StringJoin(o)
|
107
|
+
visit o.left
|
108
|
+
end
|
109
|
+
|
110
|
+
def visit_Arel_Attribute(o)
|
111
|
+
visit o.relation
|
112
|
+
visit o.name
|
113
|
+
end
|
114
|
+
alias :visit_Arel_Attributes_Integer :visit_Arel_Attribute
|
115
|
+
alias :visit_Arel_Attributes_Float :visit_Arel_Attribute
|
116
|
+
alias :visit_Arel_Attributes_String :visit_Arel_Attribute
|
117
|
+
alias :visit_Arel_Attributes_Time :visit_Arel_Attribute
|
118
|
+
alias :visit_Arel_Attributes_Boolean :visit_Arel_Attribute
|
119
|
+
alias :visit_Arel_Attributes_Attribute :visit_Arel_Attribute
|
120
|
+
alias :visit_Arel_Attributes_Decimal :visit_Arel_Attribute
|
121
|
+
|
122
|
+
def visit_Arel_Table(o)
|
123
|
+
visit o.name
|
124
|
+
end
|
125
|
+
|
126
|
+
def terminal(o)
|
127
|
+
end
|
128
|
+
alias :visit_ActiveSupport_Multibyte_Chars :terminal
|
129
|
+
alias :visit_ActiveSupport_StringInquirer :terminal
|
130
|
+
alias :visit_Arel_Nodes_Lock :terminal
|
131
|
+
alias :visit_Arel_Nodes_Node :terminal
|
132
|
+
alias :visit_Arel_Nodes_SqlLiteral :terminal
|
133
|
+
alias :visit_Arel_Nodes_BindParam :terminal
|
134
|
+
alias :visit_Arel_Nodes_Window :terminal
|
135
|
+
alias :visit_Arel_Nodes_True :terminal
|
136
|
+
alias :visit_Arel_Nodes_False :terminal
|
137
|
+
alias :visit_BigDecimal :terminal
|
138
|
+
alias :visit_Class :terminal
|
139
|
+
alias :visit_Date :terminal
|
140
|
+
alias :visit_DateTime :terminal
|
141
|
+
alias :visit_FalseClass :terminal
|
142
|
+
alias :visit_Float :terminal
|
143
|
+
alias :visit_Integer :terminal
|
144
|
+
alias :visit_NilClass :terminal
|
145
|
+
alias :visit_String :terminal
|
146
|
+
alias :visit_Symbol :terminal
|
147
|
+
alias :visit_Time :terminal
|
148
|
+
alias :visit_TrueClass :terminal
|
149
|
+
|
150
|
+
def visit_Arel_Nodes_InsertStatement(o)
|
151
|
+
visit o.relation
|
152
|
+
visit o.columns
|
153
|
+
visit o.values
|
154
|
+
end
|
155
|
+
|
156
|
+
def visit_Arel_Nodes_SelectCore(o)
|
157
|
+
visit o.projections
|
158
|
+
visit o.source
|
159
|
+
visit o.wheres
|
160
|
+
visit o.groups
|
161
|
+
visit o.windows
|
162
|
+
visit o.havings
|
163
|
+
end
|
164
|
+
|
165
|
+
def visit_Arel_Nodes_SelectStatement(o)
|
166
|
+
visit o.cores
|
167
|
+
visit o.orders
|
168
|
+
visit o.limit
|
169
|
+
visit o.lock
|
170
|
+
visit o.offset
|
171
|
+
end
|
172
|
+
|
173
|
+
def visit_Arel_Nodes_UpdateStatement(o)
|
174
|
+
visit o.relation
|
175
|
+
visit o.values
|
176
|
+
visit o.wheres
|
177
|
+
visit o.orders
|
178
|
+
visit o.limit
|
179
|
+
end
|
180
|
+
|
181
|
+
def visit_Arel_Nodes_Comment(o)
|
182
|
+
visit o.values
|
183
|
+
end
|
184
|
+
|
185
|
+
def visit_Array(o)
|
186
|
+
o.each { |i| visit i }
|
187
|
+
end
|
188
|
+
alias :visit_Set :visit_Array
|
189
|
+
|
190
|
+
def visit_Hash(o)
|
191
|
+
o.each { |k, v| visit(k); visit(v) }
|
192
|
+
end
|
193
|
+
|
194
|
+
DISPATCH = dispatch_cache
|
195
|
+
|
196
|
+
def get_dispatch_cache
|
197
|
+
DISPATCH
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
@@ -129,6 +129,12 @@ class ActiveRecord::Associations::Association
|
|
129
129
|
alias skip_statement_cache_orig skip_statement_cache?
|
130
130
|
def skip_statement_cache?(*scope)
|
131
131
|
return true if klass.respond_to?(:scoped_by_tenant?) && klass.scoped_by_tenant?
|
132
|
+
|
133
|
+
if reflection.through_reflection
|
134
|
+
through_klass = reflection.through_reflection.klass
|
135
|
+
return true if through_klass.respond_to?(:scoped_by_tenant?) && through_klass.scoped_by_tenant?
|
136
|
+
end
|
137
|
+
|
132
138
|
skip_statement_cache_orig(*scope)
|
133
139
|
end
|
134
140
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_record'
|
2
|
+
require_relative "./arel_visitors_depth_first.rb" unless Arel::Visitors.const_defined?(:DepthFirst)
|
2
3
|
|
3
4
|
module MultiTenant
|
4
5
|
class Table
|
@@ -31,6 +32,7 @@ module MultiTenant
|
|
31
32
|
@arel_node = arel_node
|
32
33
|
@known_relations = []
|
33
34
|
@handled_relations = []
|
35
|
+
@discovering = false
|
34
36
|
end
|
35
37
|
|
36
38
|
def discover_relations
|
@@ -54,7 +56,7 @@ module MultiTenant
|
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
class ArelTenantVisitor < Arel::Visitors::DepthFirst
|
59
|
+
class ArelTenantVisitor < Arel::Visitors.const_defined?(:DepthFirst) ? Arel::Visitors::DepthFirst : ::MultiTenant::ArelVisitorsDepthFirst
|
58
60
|
def initialize(arel)
|
59
61
|
super(Proc.new {})
|
60
62
|
@statement_node_id = nil
|
@@ -412,7 +412,7 @@ describe MultiTenant do
|
|
412
412
|
account1 = Account.create! name: 'Account 1'
|
413
413
|
category1 = Category.create! name: 'Category 1'
|
414
414
|
|
415
|
-
expected_sql = if uses_prepared_statements? && ActiveRecord::VERSION::MAJOR == 5
|
415
|
+
expected_sql = if uses_prepared_statements? && (ActiveRecord::VERSION::MAJOR == 5 || (ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR >= 1))
|
416
416
|
<<-sql
|
417
417
|
SELECT "projects"."id" AS t0_r0, "projects"."account_id" AS t0_r1, "projects"."name" AS t0_r2, "categories"."id" AS t1_r0, "categories"."name" AS t1_r1 FROM "projects" LEFT OUTER JOIN "project_categories" ON "project_categories"."project_id" = "projects"."id" AND "project_categories"."account_id" = 1 AND "projects"."account_id" = 1 LEFT OUTER JOIN "categories" ON "categories"."id" = "project_categories"."category_id" AND "project_categories"."account_id" = 1 WHERE "projects"."account_id" = 1
|
418
418
|
sql
|
@@ -451,7 +451,7 @@ describe MultiTenant do
|
|
451
451
|
category1 = Category.create! name: 'Category 1'
|
452
452
|
|
453
453
|
MultiTenant.with(account1) do
|
454
|
-
expected_sql = if uses_prepared_statements? && ActiveRecord::VERSION::MAJOR == 5
|
454
|
+
expected_sql = if uses_prepared_statements? && (ActiveRecord::VERSION::MAJOR == 5 || (ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR >= 1))
|
455
455
|
<<-sql
|
456
456
|
SELECT "tasks".* FROM "tasks" INNER JOIN "projects" ON "projects"."id" = "tasks"."project_id" AND "projects"."account_id" = 1 LEFT JOIN project_categories pc ON project.category_id = pc.id WHERE "tasks"."account_id" = 1
|
457
457
|
sql
|
@@ -59,4 +59,40 @@ describe MultiTenant, 'Record finding' do
|
|
59
59
|
expect(second_found).to eq(second_record)
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
context 'model with has_many relation through multi-tenant model' do
|
64
|
+
let(:tenant_1) { Account.create! name: 'Tenant 1' }
|
65
|
+
let(:project_1) { tenant_1.projects.create! }
|
66
|
+
|
67
|
+
let(:tenant_2) { Account.create! name: 'Tenant 2' }
|
68
|
+
let(:project_2) { tenant_2.projects.create! }
|
69
|
+
|
70
|
+
let(:category) { Category.create! name: 'Category' }
|
71
|
+
|
72
|
+
before do
|
73
|
+
ProjectCategory.create! account: tenant_1, name: '1', project: project_1, category: category
|
74
|
+
ProjectCategory.create! account: tenant_2, name: '2', project: project_2, category: category
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'can get model without creating query cache' do
|
78
|
+
MultiTenant.with(tenant_1) do
|
79
|
+
found_category = Project.find(project_1.id).categories.to_a.first
|
80
|
+
expect(found_category).to eq(category)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'can get model for other tenant' do
|
85
|
+
MultiTenant.with(tenant_2) do
|
86
|
+
found_category = Project.find(project_2.id).categories.to_a.first
|
87
|
+
expect(found_category).to eq(category)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'can get model without current_tenant' do
|
92
|
+
MultiTenant.without do
|
93
|
+
found_category = Project.find(project_2.id).categories.to_a.first
|
94
|
+
expect(found_category).to eq(category)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
62
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-multi-tenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Citus Data
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: request_store
|
@@ -172,11 +172,16 @@ files:
|
|
172
172
|
- gemfiles/active_record_5.2.gemfile.lock
|
173
173
|
- gemfiles/active_record_6.0.gemfile
|
174
174
|
- gemfiles/active_record_6.0.gemfile.lock
|
175
|
+
- gemfiles/active_record_6.1.gemfile
|
176
|
+
- gemfiles/active_record_6.1.gemfile.lock
|
175
177
|
- gemfiles/rails_5.2.gemfile
|
176
178
|
- gemfiles/rails_5.2.gemfile.lock
|
177
179
|
- gemfiles/rails_6.0.gemfile
|
178
180
|
- gemfiles/rails_6.0.gemfile.lock
|
181
|
+
- gemfiles/rails_6.1.gemfile
|
182
|
+
- gemfiles/rails_6.1.gemfile.lock
|
179
183
|
- lib/activerecord-multi-tenant.rb
|
184
|
+
- lib/activerecord-multi-tenant/arel_visitors_depth_first.rb
|
180
185
|
- lib/activerecord-multi-tenant/controller_extensions.rb
|
181
186
|
- lib/activerecord-multi-tenant/copy_from_client.rb
|
182
187
|
- lib/activerecord-multi-tenant/fast_truncate.rb
|
@@ -206,7 +211,7 @@ homepage: https://github.com/citusdata/activerecord-multi-tenant
|
|
206
211
|
licenses:
|
207
212
|
- MIT
|
208
213
|
metadata: {}
|
209
|
-
post_install_message:
|
214
|
+
post_install_message:
|
210
215
|
rdoc_options: []
|
211
216
|
require_paths:
|
212
217
|
- lib
|
@@ -222,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
227
|
version: '0'
|
223
228
|
requirements: []
|
224
229
|
rubygems_version: 3.1.2
|
225
|
-
signing_key:
|
230
|
+
signing_key:
|
226
231
|
specification_version: 4
|
227
232
|
summary: ActiveRecord/Rails integration for multi-tenant databases, in particular
|
228
233
|
the Citus extension for PostgreSQL
|