activerecord-multi-tenant 1.2.0 → 2.4.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 +4 -4
- data/.github/workflows/active-record-multi-tenant-tests.yml +83 -0
- data/.gitignore +6 -0
- data/.readthedocs.yaml +15 -0
- data/.rspec +0 -0
- data/.rubocop.yml +51 -0
- data/Appraisals +6 -22
- data/CHANGELOG.md +51 -0
- data/Gemfile +3 -1
- data/LICENSE +0 -0
- data/README.md +3 -2
- data/Rakefile +1 -1
- data/activerecord-multi-tenant.gemspec +28 -23
- data/docker-compose.yml +24 -18
- data/docs/.gitignore +3 -0
- data/docs/Makefile +28 -0
- data/docs/api-reference.sh +10 -0
- data/docs/requirements.in +4 -0
- data/docs/requirements.txt +62 -0
- data/docs/source/_static/api-reference/ActiveRecord/Associations/Association.html +285 -0
- data/docs/source/_static/api-reference/ActiveRecord/Associations/ClassMethods.html +255 -0
- data/docs/source/_static/api-reference/ActiveRecord/Associations.html +117 -0
- data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters/SchemaStatements.html +232 -0
- data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters.html +126 -0
- data/docs/source/_static/api-reference/ActiveRecord/QueryMethods.html +336 -0
- data/docs/source/_static/api-reference/ActiveRecord/SchemaDumper.html +121 -0
- data/docs/source/_static/api-reference/ActiveRecord.html +130 -0
- data/docs/source/_static/api-reference/MultiTenant/ArelTenantVisitor.html +755 -0
- data/docs/source/_static/api-reference/MultiTenant/ArelVisitorsDepthFirst.html +208 -0
- data/docs/source/_static/api-reference/MultiTenant/BaseTenantEnforcementClause.html +462 -0
- data/docs/source/_static/api-reference/MultiTenant/Context.html +659 -0
- data/docs/source/_static/api-reference/MultiTenant/ControllerExtensions.html +202 -0
- data/docs/source/_static/api-reference/MultiTenant/CopyFromClient.html +186 -0
- data/docs/source/_static/api-reference/MultiTenant/CopyFromClientHelper.html +362 -0
- data/docs/source/_static/api-reference/MultiTenant/Current.html +124 -0
- data/docs/source/_static/api-reference/MultiTenant/DatabaseStatements.html +366 -0
- data/docs/source/_static/api-reference/MultiTenant/FastTruncate.html +226 -0
- data/docs/source/_static/api-reference/MultiTenant/MigrationExtensions.html +554 -0
- data/docs/source/_static/api-reference/MultiTenant/MissingTenantError.html +124 -0
- data/docs/source/_static/api-reference/MultiTenant/ModelExtensionsClassMethods.html +492 -0
- data/docs/source/_static/api-reference/MultiTenant/QueryMonitor.html +257 -0
- data/docs/source/_static/api-reference/MultiTenant/Table.html +419 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantEnforcementClause.html +148 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantIsImmutable.html +135 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantJoinEnforcementClause.html +310 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantValueVisitor.html +239 -0
- data/docs/source/_static/api-reference/MultiTenant.html +1454 -0
- data/docs/source/_static/api-reference/MultiTenantFindBy.html +180 -0
- data/docs/source/_static/api-reference/Sidekiq/Client.html +302 -0
- data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Client.html +217 -0
- data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Server.html +219 -0
- data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant.html +126 -0
- data/docs/source/_static/api-reference/Sidekiq.html +126 -0
- data/docs/source/_static/api-reference/_index.html +399 -0
- data/docs/source/_static/api-reference/class_list.html +51 -0
- data/docs/source/_static/api-reference/css/common.css +1 -0
- data/docs/source/_static/api-reference/css/full_list.css +58 -0
- data/docs/source/_static/api-reference/css/style.css +497 -0
- data/docs/source/_static/api-reference/file.README.html +167 -0
- data/docs/source/_static/api-reference/file_list.html +56 -0
- data/docs/source/_static/api-reference/frames.html +17 -0
- data/docs/source/_static/api-reference/index.html +167 -0
- data/docs/source/_static/api-reference/js/app.js +314 -0
- data/docs/source/_static/api-reference/js/full_list.js +216 -0
- data/docs/source/_static/api-reference/js/jquery.js +4 -0
- data/docs/source/_static/api-reference/method_list.html +715 -0
- data/docs/source/_static/api-reference/top-level-namespace.html +126 -0
- data/docs/source/_templates/.gitignore +4 -0
- data/docs/source/api-reference.rst +8 -0
- data/docs/source/appendix.rst +26 -0
- data/docs/source/changelog.rst +8 -0
- data/docs/source/community-and-support.rst +26 -0
- data/docs/source/conf.py +30 -0
- data/docs/source/contributing.rst +70 -0
- data/docs/source/getting-started.rst +37 -0
- data/docs/source/guides-and-tutorials.rst +129 -0
- data/docs/source/index.rst +54 -0
- data/docs/source/introduction.rst +33 -0
- data/docs/source/license.rst +22 -0
- data/docs/source/troubleshooting.rst +41 -0
- data/docs/source/usage-guide.rst +59 -0
- data/lib/activerecord-multi-tenant/arel_visitors_depth_first.rb +183 -174
- data/lib/activerecord-multi-tenant/controller_extensions.rb +15 -4
- data/lib/activerecord-multi-tenant/copy_from_client.rb +4 -0
- data/lib/activerecord-multi-tenant/fast_truncate.rb +4 -2
- data/lib/activerecord-multi-tenant/habtm.rb +50 -0
- data/lib/activerecord-multi-tenant/migrations.rb +87 -10
- data/lib/activerecord-multi-tenant/model_extensions.rb +98 -34
- data/lib/activerecord-multi-tenant/multi_tenant.rb +102 -29
- data/lib/activerecord-multi-tenant/query_monitor.rb +21 -5
- data/lib/activerecord-multi-tenant/query_rewriter.rb +122 -91
- data/lib/activerecord-multi-tenant/sidekiq.rb +46 -19
- data/lib/activerecord-multi-tenant/table_node.rb +13 -0
- data/lib/activerecord-multi-tenant/version.rb +1 -1
- data/lib/activerecord-multi-tenant.rb +3 -13
- data/lib/activerecord_multi_tenant.rb +13 -0
- data/spec/activerecord-multi-tenant/associations_spec.rb +42 -0
- data/spec/activerecord-multi-tenant/controller_extensions_spec.rb +3 -2
- data/spec/activerecord-multi-tenant/fast_truncate_spec.rb +8 -6
- data/spec/activerecord-multi-tenant/model_extensions_spec.rb +347 -143
- data/spec/activerecord-multi-tenant/multi_tenant_spec.rb +69 -13
- data/spec/activerecord-multi-tenant/query_rewriter_spec.rb +60 -59
- data/spec/activerecord-multi-tenant/record_callback_spec.rb +0 -0
- data/spec/activerecord-multi-tenant/record_finding_spec.rb +11 -11
- data/spec/activerecord-multi-tenant/record_modifications_spec.rb +23 -4
- data/spec/activerecord-multi-tenant/sidekiq_spec.rb +10 -10
- data/spec/database.yml +0 -0
- data/spec/schema.rb +43 -2
- data/spec/spec_helper.rb +52 -16
- data/spec/support/format_sql.rb +20 -0
- metadata +126 -36
- data/.github/workflows/CI.yml +0 -63
- data/gemfiles/.bundle/config +0 -2
- data/gemfiles/active_record_5.2.gemfile +0 -16
- data/gemfiles/active_record_6.0.gemfile +0 -8
- data/gemfiles/active_record_6.1.gemfile +0 -8
- data/gemfiles/active_record_7.0.gemfile +0 -8
- data/gemfiles/rails_5.2.gemfile +0 -16
- data/gemfiles/rails_6.0.gemfile +0 -8
- data/gemfiles/rails_6.1.gemfile +0 -8
- data/gemfiles/rails_7.0.gemfile +0 -8
- data/lib/activerecord-multi-tenant/persistence_extension.rb +0 -13
- data/lib/activerecord-multi-tenant/with_lock.rb +0 -15
- data/spec/activerecord-multi-tenant/schema_dumper_tester.rb +0 -0
@@ -0,0 +1,497 @@
|
|
1
|
+
html {
|
2
|
+
width: 100%;
|
3
|
+
height: 100%;
|
4
|
+
}
|
5
|
+
body {
|
6
|
+
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
|
7
|
+
font-size: 13px;
|
8
|
+
width: 100%;
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
display: flex;
|
12
|
+
display: -webkit-flex;
|
13
|
+
display: -ms-flexbox;
|
14
|
+
}
|
15
|
+
|
16
|
+
#nav {
|
17
|
+
position: relative;
|
18
|
+
width: 100%;
|
19
|
+
height: 100%;
|
20
|
+
border: 0;
|
21
|
+
border-right: 1px dotted #eee;
|
22
|
+
overflow: auto;
|
23
|
+
}
|
24
|
+
.nav_wrap {
|
25
|
+
margin: 0;
|
26
|
+
padding: 0;
|
27
|
+
width: 20%;
|
28
|
+
height: 100%;
|
29
|
+
position: relative;
|
30
|
+
display: flex;
|
31
|
+
display: -webkit-flex;
|
32
|
+
display: -ms-flexbox;
|
33
|
+
flex-shrink: 0;
|
34
|
+
-webkit-flex-shrink: 0;
|
35
|
+
-ms-flex: 1 0;
|
36
|
+
}
|
37
|
+
#resizer {
|
38
|
+
position: absolute;
|
39
|
+
right: -5px;
|
40
|
+
top: 0;
|
41
|
+
width: 10px;
|
42
|
+
height: 100%;
|
43
|
+
cursor: col-resize;
|
44
|
+
z-index: 9999;
|
45
|
+
}
|
46
|
+
#main {
|
47
|
+
flex: 5 1;
|
48
|
+
-webkit-flex: 5 1;
|
49
|
+
-ms-flex: 5 1;
|
50
|
+
outline: none;
|
51
|
+
position: relative;
|
52
|
+
background: #fff;
|
53
|
+
padding: 1.2em;
|
54
|
+
padding-top: 0.2em;
|
55
|
+
box-sizing: border-box;
|
56
|
+
}
|
57
|
+
|
58
|
+
@media (max-width: 920px) {
|
59
|
+
.nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; }
|
60
|
+
#resizer { display: none; }
|
61
|
+
#nav {
|
62
|
+
z-index: 9999;
|
63
|
+
background: #fff;
|
64
|
+
display: none;
|
65
|
+
position: absolute;
|
66
|
+
top: 40px;
|
67
|
+
right: 12px;
|
68
|
+
width: 500px;
|
69
|
+
max-width: 80%;
|
70
|
+
height: 80%;
|
71
|
+
overflow-y: scroll;
|
72
|
+
border: 1px solid #999;
|
73
|
+
border-collapse: collapse;
|
74
|
+
box-shadow: -7px 5px 25px #aaa;
|
75
|
+
border-radius: 2px;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
@media (min-width: 920px) {
|
80
|
+
body { height: 100%; overflow: hidden; }
|
81
|
+
#main { height: 100%; overflow: auto; }
|
82
|
+
#search { display: none; }
|
83
|
+
}
|
84
|
+
|
85
|
+
#main img { max-width: 100%; }
|
86
|
+
h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; }
|
87
|
+
h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; }
|
88
|
+
h1.title { margin-bottom: 10px; }
|
89
|
+
h1.alphaindex { margin-top: 0; font-size: 22px; }
|
90
|
+
h2 {
|
91
|
+
padding: 0;
|
92
|
+
padding-bottom: 3px;
|
93
|
+
border-bottom: 1px #aaa solid;
|
94
|
+
font-size: 1.4em;
|
95
|
+
margin: 1.8em 0 0.5em;
|
96
|
+
position: relative;
|
97
|
+
}
|
98
|
+
h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; }
|
99
|
+
h2 small a {
|
100
|
+
display: block;
|
101
|
+
height: 20px;
|
102
|
+
border: 1px solid #aaa;
|
103
|
+
border-bottom: 0;
|
104
|
+
border-top-left-radius: 5px;
|
105
|
+
background: #f8f8f8;
|
106
|
+
position: relative;
|
107
|
+
padding: 2px 7px;
|
108
|
+
}
|
109
|
+
.clear { clear: both; }
|
110
|
+
.inline { display: inline; }
|
111
|
+
.inline p:first-child { display: inline; }
|
112
|
+
.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; }
|
113
|
+
.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt {
|
114
|
+
color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em;
|
115
|
+
border-radius: 4px;
|
116
|
+
}
|
117
|
+
.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; }
|
118
|
+
.docstring h1 { font-size: 1.2em; }
|
119
|
+
.docstring h2 { font-size: 1.1em; }
|
120
|
+
.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; }
|
121
|
+
.summary_desc .object_link a, .docstring .object_link a {
|
122
|
+
font-family: monospace; font-size: 1.05em;
|
123
|
+
color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em;
|
124
|
+
border-radius: 4px;
|
125
|
+
}
|
126
|
+
.rdoc-term { padding-right: 25px; font-weight: bold; }
|
127
|
+
.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; }
|
128
|
+
.summary_desc pre.code .object_link a, .docstring pre.code .object_link a {
|
129
|
+
padding: 0px; background: inherit; color: inherit; border-radius: inherit;
|
130
|
+
}
|
131
|
+
|
132
|
+
/* style for <table> */
|
133
|
+
#filecontents table, .docstring table { border-collapse: collapse; }
|
134
|
+
#filecontents table th, #filecontents table td,
|
135
|
+
.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; }
|
136
|
+
#filecontents table tr:nth-child(odd),
|
137
|
+
.docstring table tr:nth-child(odd) { background: #eee; }
|
138
|
+
#filecontents table tr:nth-child(even),
|
139
|
+
.docstring table tr:nth-child(even) { background: #fff; }
|
140
|
+
#filecontents table th, .docstring table th { background: #fff; }
|
141
|
+
|
142
|
+
/* style for <ul> */
|
143
|
+
#filecontents li > p, .docstring li > p { margin: 0px; }
|
144
|
+
#filecontents ul, .docstring ul { padding-left: 20px; }
|
145
|
+
/* style for <dl> */
|
146
|
+
#filecontents dl, .docstring dl { border: 1px solid #ccc; }
|
147
|
+
#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; }
|
148
|
+
#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; }
|
149
|
+
#filecontents dd > p, .docstring dd > p { margin: 0px; }
|
150
|
+
|
151
|
+
.note {
|
152
|
+
color: #222;
|
153
|
+
margin: 20px 0;
|
154
|
+
padding: 10px;
|
155
|
+
border: 1px solid #eee;
|
156
|
+
border-radius: 3px;
|
157
|
+
display: block;
|
158
|
+
}
|
159
|
+
.docstring .note {
|
160
|
+
border-left-color: #ccc;
|
161
|
+
border-left-width: 5px;
|
162
|
+
}
|
163
|
+
.note.todo { background: #ffffc5; border-color: #ececaa; }
|
164
|
+
.note.returns_void { background: #efefef; }
|
165
|
+
.note.deprecated { background: #ffe5e5; border-color: #e9dada; }
|
166
|
+
.note.title.deprecated { background: #ffe5e5; border-color: #e9dada; }
|
167
|
+
.note.private { background: #ffffc5; border-color: #ececaa; }
|
168
|
+
.note.title { padding: 3px 6px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; }
|
169
|
+
.summary_signature + .note.title { margin-left: 7px; }
|
170
|
+
h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; }
|
171
|
+
.note.title { background: #efefef; }
|
172
|
+
.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
173
|
+
.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; }
|
174
|
+
.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
175
|
+
.note.title.private { background: #d5d5d5; border-color: #c5c5c5; }
|
176
|
+
.note.title.not_defined_here { background: transparent; border: none; font-style: italic; }
|
177
|
+
.discussion .note { margin-top: 6px; }
|
178
|
+
.discussion .note:first-child { margin-top: 0; }
|
179
|
+
|
180
|
+
h3.inherited {
|
181
|
+
font-style: italic;
|
182
|
+
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
|
183
|
+
font-weight: normal;
|
184
|
+
padding: 0;
|
185
|
+
margin: 0;
|
186
|
+
margin-top: 12px;
|
187
|
+
margin-bottom: 3px;
|
188
|
+
font-size: 13px;
|
189
|
+
}
|
190
|
+
p.inherited {
|
191
|
+
padding: 0;
|
192
|
+
margin: 0;
|
193
|
+
margin-left: 25px;
|
194
|
+
}
|
195
|
+
|
196
|
+
.box_info dl {
|
197
|
+
margin: 0;
|
198
|
+
border: 0;
|
199
|
+
width: 100%;
|
200
|
+
font-size: 1em;
|
201
|
+
display: flex;
|
202
|
+
display: -webkit-flex;
|
203
|
+
display: -ms-flexbox;
|
204
|
+
}
|
205
|
+
.box_info dl dt {
|
206
|
+
flex-shrink: 0;
|
207
|
+
-webkit-flex-shrink: 1;
|
208
|
+
-ms-flex-shrink: 1;
|
209
|
+
width: 100px;
|
210
|
+
text-align: right;
|
211
|
+
font-weight: bold;
|
212
|
+
border: 1px solid #aaa;
|
213
|
+
border-width: 1px 0px 0px 1px;
|
214
|
+
padding: 6px 0;
|
215
|
+
padding-right: 10px;
|
216
|
+
}
|
217
|
+
.box_info dl dd {
|
218
|
+
flex-grow: 1;
|
219
|
+
-webkit-flex-grow: 1;
|
220
|
+
-ms-flex: 1;
|
221
|
+
max-width: 420px;
|
222
|
+
padding: 6px 0;
|
223
|
+
padding-right: 20px;
|
224
|
+
border: 1px solid #aaa;
|
225
|
+
border-width: 1px 1px 0 0;
|
226
|
+
overflow: hidden;
|
227
|
+
position: relative;
|
228
|
+
}
|
229
|
+
.box_info dl:last-child > * {
|
230
|
+
border-bottom: 1px solid #aaa;
|
231
|
+
}
|
232
|
+
.box_info dl:nth-child(odd) > * { background: #eee; }
|
233
|
+
.box_info dl:nth-child(even) > * { background: #fff; }
|
234
|
+
.box_info dl > * { margin: 0; }
|
235
|
+
|
236
|
+
ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; }
|
237
|
+
.index_inline_list { padding-left: 0; font-size: 1.1em; }
|
238
|
+
|
239
|
+
.index_inline_list li {
|
240
|
+
list-style: none;
|
241
|
+
display: inline-block;
|
242
|
+
padding: 0 12px;
|
243
|
+
line-height: 30px;
|
244
|
+
margin-bottom: 5px;
|
245
|
+
}
|
246
|
+
|
247
|
+
dl.constants { margin-left: 10px; }
|
248
|
+
dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; }
|
249
|
+
dl.constants.compact dt { display: inline-block; font-weight: normal }
|
250
|
+
dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; }
|
251
|
+
dl.constants .docstring .note:first-child { margin-top: 5px; }
|
252
|
+
|
253
|
+
.summary_desc {
|
254
|
+
margin-left: 32px;
|
255
|
+
display: block;
|
256
|
+
font-family: sans-serif;
|
257
|
+
font-size: 1.1em;
|
258
|
+
margin-top: 8px;
|
259
|
+
line-height: 1.5145em;
|
260
|
+
margin-bottom: 0.8em;
|
261
|
+
}
|
262
|
+
.summary_desc tt { font-size: 0.9em; }
|
263
|
+
dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; }
|
264
|
+
dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; }
|
265
|
+
dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; }
|
266
|
+
dl.constants .discussion *:first-child { margin-top: 0; }
|
267
|
+
dl.constants .discussion *:last-child { margin-bottom: 0; }
|
268
|
+
|
269
|
+
.method_details { border-top: 1px dotted #ccc; margin-top: 25px; padding-top: 0; }
|
270
|
+
.method_details.first { border: 0; margin-top: 5px; }
|
271
|
+
.method_details.first h3.signature { margin-top: 1em; }
|
272
|
+
p.signature, h3.signature {
|
273
|
+
font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
|
274
|
+
padding: 6px 10px; margin-top: 1em;
|
275
|
+
background: #E8F4FF; border: 1px solid #d8d8e5; border-radius: 5px;
|
276
|
+
}
|
277
|
+
p.signature tt,
|
278
|
+
h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; }
|
279
|
+
p.signature .overload,
|
280
|
+
h3.signature .overload { display: block; }
|
281
|
+
p.signature .extras,
|
282
|
+
h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; }
|
283
|
+
p.signature .not_defined_here,
|
284
|
+
h3.signature .not_defined_here,
|
285
|
+
p.signature .aliases,
|
286
|
+
h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; }
|
287
|
+
p.signature .aliases .names,
|
288
|
+
h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; }
|
289
|
+
|
290
|
+
.tags .tag_title { font-size: 1.05em; margin-bottom: 0; font-weight: bold; }
|
291
|
+
.tags .tag_title tt { color: initial; padding: initial; background: initial; }
|
292
|
+
.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; }
|
293
|
+
.tags ul li { margin-bottom: 3px; }
|
294
|
+
.tags ul .name { font-family: monospace; font-weight: bold; }
|
295
|
+
.tags ul .note { padding: 3px 6px; }
|
296
|
+
.tags { margin-bottom: 12px; }
|
297
|
+
|
298
|
+
.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; }
|
299
|
+
.tags .examples .inline p { padding: 0; margin: 0; font-weight: bold; font-size: 1em; }
|
300
|
+
.tags .examples .inline p:before { content: "▸"; font-size: 1em; margin-right: 5px; }
|
301
|
+
|
302
|
+
.tags .overload .overload_item { list-style: none; margin-bottom: 25px; }
|
303
|
+
.tags .overload .overload_item .signature {
|
304
|
+
padding: 2px 8px;
|
305
|
+
background: #F1F8FF; border: 1px solid #d8d8e5; border-radius: 3px;
|
306
|
+
}
|
307
|
+
.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; }
|
308
|
+
.tags .overload .docstring { margin-top: 15px; }
|
309
|
+
|
310
|
+
.defines { display: none; }
|
311
|
+
|
312
|
+
#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; }
|
313
|
+
|
314
|
+
.showSource { font-size: 0.9em; }
|
315
|
+
.showSource a, .showSource a:visited { text-decoration: none; color: #666; }
|
316
|
+
|
317
|
+
#content a, #content a:visited { text-decoration: none; color: #05a; }
|
318
|
+
#content a:hover { background: #ffffa5; }
|
319
|
+
|
320
|
+
ul.summary {
|
321
|
+
list-style: none;
|
322
|
+
font-family: monospace;
|
323
|
+
font-size: 1em;
|
324
|
+
line-height: 1.5em;
|
325
|
+
padding-left: 0px;
|
326
|
+
}
|
327
|
+
ul.summary a, ul.summary a:visited {
|
328
|
+
text-decoration: none; font-size: 1.1em;
|
329
|
+
}
|
330
|
+
ul.summary li { margin-bottom: 5px; }
|
331
|
+
.summary_signature { padding: 4px 8px; background: #f8f8f8; border: 1px solid #f0f0f0; border-radius: 5px; }
|
332
|
+
.summary_signature:hover { background: #CFEBFF; border-color: #A4CCDA; cursor: pointer; }
|
333
|
+
.summary_signature.deprecated { background: #ffe5e5; border-color: #e9dada; }
|
334
|
+
ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;}
|
335
|
+
ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; }
|
336
|
+
#content .summary_signature:hover a,
|
337
|
+
#content .summary_signature:hover a:visited {
|
338
|
+
background: transparent;
|
339
|
+
color: #049;
|
340
|
+
}
|
341
|
+
|
342
|
+
p.inherited a { font-family: monospace; font-size: 0.9em; }
|
343
|
+
p.inherited { word-spacing: 5px; font-size: 1.2em; }
|
344
|
+
|
345
|
+
p.children { font-size: 1.2em; }
|
346
|
+
p.children a { font-size: 0.9em; }
|
347
|
+
p.children strong { font-size: 0.8em; }
|
348
|
+
p.children strong.modules { padding-left: 5px; }
|
349
|
+
|
350
|
+
ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; }
|
351
|
+
ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; }
|
352
|
+
ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgw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YAAAOpgAABdvkl/FRgAAAHtJREFUeNqMzrEJAkEURdGzuhgZbSoYWcAWoBVsB4JgZAGmphsZCZYzTQgWNCYrDN9RvMmHx+X916SUBFbo8CzD1idXrLErw1mQttgXtyrOcQ/Ny5p4Qh+2XqLYYazsPWNTiuMkRxa4vcV+evuNAUOLIx5+c2hyzv7hNQC67Q+/HHmlEwAAAABJRU5ErkJggg==) no-repeat top center; }
|
353
|
+
ul.fullTree li:first-child { padding-top: 0; background: transparent; }
|
354
|
+
ul.fullTree li:last-child { padding-bottom: 0; }
|
355
|
+
.showAll ul.fullTree { display: block; }
|
356
|
+
.showAll .inheritName { display: none; }
|
357
|
+
|
358
|
+
#search { position: absolute; right: 12px; top: 0px; z-index: 9000; }
|
359
|
+
#search a {
|
360
|
+
display: block; float: left;
|
361
|
+
padding: 4px 8px; text-decoration: none; color: #05a; fill: #05a;
|
362
|
+
border: 1px solid #d8d8e5;
|
363
|
+
border-bottom-left-radius: 3px; border-bottom-right-radius: 3px;
|
364
|
+
background: #F1F8FF;
|
365
|
+
box-shadow: -1px 1px 3px #ddd;
|
366
|
+
}
|
367
|
+
#search a:hover { background: #f5faff; color: #06b; fill: #06b; }
|
368
|
+
#search a.active {
|
369
|
+
background: #568; padding-bottom: 20px; color: #fff; fill: #fff;
|
370
|
+
border: 1px solid #457;
|
371
|
+
border-top-left-radius: 5px; border-top-right-radius: 5px;
|
372
|
+
}
|
373
|
+
#search a.inactive { color: #999; fill: #999; }
|
374
|
+
.inheritanceTree, .toggleDefines {
|
375
|
+
float: right;
|
376
|
+
border-left: 1px solid #aaa;
|
377
|
+
position: absolute; top: 0; right: 0;
|
378
|
+
height: 100%;
|
379
|
+
background: #f6f6f6;
|
380
|
+
padding: 5px;
|
381
|
+
min-width: 55px;
|
382
|
+
text-align: center;
|
383
|
+
}
|
384
|
+
|
385
|
+
#menu { font-size: 1.3em; color: #bbb; }
|
386
|
+
#menu .title, #menu a { font-size: 0.7em; }
|
387
|
+
#menu .title a { font-size: 1em; }
|
388
|
+
#menu .title { color: #555; }
|
389
|
+
#menu a, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; }
|
390
|
+
#menu a:hover { color: #05a; }
|
391
|
+
|
392
|
+
#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; }
|
393
|
+
#footer a, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; }
|
394
|
+
#footer a:hover { color: #05a; }
|
395
|
+
|
396
|
+
#listing ul.alpha { font-size: 1.1em; }
|
397
|
+
#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; }
|
398
|
+
#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; }
|
399
|
+
#listing ul.alpha ul { margin: 0; padding-left: 15px; }
|
400
|
+
#listing ul small { color: #666; font-size: 0.7em; }
|
401
|
+
|
402
|
+
li.r1 { background: #f0f0f0; }
|
403
|
+
li.r2 { background: #fafafa; }
|
404
|
+
|
405
|
+
#content ul.summary li.deprecated .summary_signature a,
|
406
|
+
#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; }
|
407
|
+
|
408
|
+
#toc {
|
409
|
+
position: relative;
|
410
|
+
float: right;
|
411
|
+
overflow-x: auto;
|
412
|
+
right: -3px;
|
413
|
+
margin-left: 20px;
|
414
|
+
margin-bottom: 20px;
|
415
|
+
padding: 20px; padding-right: 30px;
|
416
|
+
max-width: 300px;
|
417
|
+
z-index: 5000;
|
418
|
+
background: #fefefe;
|
419
|
+
border: 1px solid #ddd;
|
420
|
+
box-shadow: -2px 2px 6px #bbb;
|
421
|
+
}
|
422
|
+
#toc .title { margin: 0; }
|
423
|
+
#toc ol { padding-left: 1.8em; }
|
424
|
+
#toc li { font-size: 1.1em; line-height: 1.7em; }
|
425
|
+
#toc > ol > li { font-size: 1.1em; font-weight: bold; }
|
426
|
+
#toc ol > li > ol { font-size: 0.9em; }
|
427
|
+
#toc ol ol > li > ol { padding-left: 2.3em; }
|
428
|
+
#toc ol + li { margin-top: 0.3em; }
|
429
|
+
#toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; }
|
430
|
+
#toc.hidden:hover { background: #fafafa; }
|
431
|
+
#filecontents h1 + #toc.nofloat { margin-top: 0; }
|
432
|
+
@media (max-width: 560px) {
|
433
|
+
#toc {
|
434
|
+
margin-left: 0;
|
435
|
+
margin-top: 16px;
|
436
|
+
float: none;
|
437
|
+
max-width: none;
|
438
|
+
}
|
439
|
+
}
|
440
|
+
|
441
|
+
/* syntax highlighting */
|
442
|
+
.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; }
|
443
|
+
#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; }
|
444
|
+
#filecontents pre.code, .docstring pre.code { display: block; }
|
445
|
+
.source_code .lines { padding-right: 12px; color: #555; text-align: right; }
|
446
|
+
#filecontents pre.code, .docstring pre.code,
|
447
|
+
.tags pre.example {
|
448
|
+
padding: 9px 14px;
|
449
|
+
margin-top: 4px;
|
450
|
+
border: 1px solid #e1e1e8;
|
451
|
+
background: #f7f7f9;
|
452
|
+
border-radius: 4px;
|
453
|
+
font-size: 1em;
|
454
|
+
overflow-x: auto;
|
455
|
+
line-height: 1.2em;
|
456
|
+
}
|
457
|
+
pre.code { color: #000; tab-size: 2; }
|
458
|
+
pre.code .info.file { color: #555; }
|
459
|
+
pre.code .val { color: #036A07; }
|
460
|
+
pre.code .tstring_content,
|
461
|
+
pre.code .heredoc_beg, pre.code .heredoc_end,
|
462
|
+
pre.code .qwords_beg, pre.code .qwords_end, pre.code .qwords_sep,
|
463
|
+
pre.code .words_beg, pre.code .words_end, pre.code .words_sep,
|
464
|
+
pre.code .qsymbols_beg, pre.code .qsymbols_end, pre.code .qsymbols_sep,
|
465
|
+
pre.code .symbols_beg, pre.code .symbols_end, pre.code .symbols_sep,
|
466
|
+
pre.code .tstring, pre.code .dstring { color: #036A07; }
|
467
|
+
pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s,
|
468
|
+
pre.code .rubyid_to_sym, pre.code .rubyid_to_f,
|
469
|
+
pre.code .dot + pre.code .id,
|
470
|
+
pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; }
|
471
|
+
pre.code .comment { color: #0066FF; }
|
472
|
+
pre.code .const, pre.code .constant { color: #585CF6; }
|
473
|
+
pre.code .label,
|
474
|
+
pre.code .symbol { color: #C5060B; }
|
475
|
+
pre.code .kw,
|
476
|
+
pre.code .rubyid_require,
|
477
|
+
pre.code .rubyid_extend,
|
478
|
+
pre.code .rubyid_include { color: #0000FF; }
|
479
|
+
pre.code .ivar { color: #318495; }
|
480
|
+
pre.code .gvar,
|
481
|
+
pre.code .rubyid_backref,
|
482
|
+
pre.code .rubyid_nth_ref { color: #6D79DE; }
|
483
|
+
pre.code .regexp, .dregexp { color: #036A07; }
|
484
|
+
pre.code a { border-bottom: 1px dotted #bbf; }
|
485
|
+
/* inline code */
|
486
|
+
*:not(pre) > code {
|
487
|
+
padding: 1px 3px 1px 3px;
|
488
|
+
border: 1px solid #E1E1E8;
|
489
|
+
background: #F7F7F9;
|
490
|
+
border-radius: 4px;
|
491
|
+
}
|
492
|
+
|
493
|
+
/* Color fix for links */
|
494
|
+
#content .summary_desc pre.code .id > .object_link a, /* identifier */
|
495
|
+
#content .docstring pre.code .id > .object_link a { color: #0085FF; }
|
496
|
+
#content .summary_desc pre.code .const > .object_link a, /* constant */
|
497
|
+
#content .docstring pre.code .const > .object_link a { color: #585CF6; }
|
@@ -0,0 +1,167 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'>
|
61
|
+
<h1 id="label-activerecord-multi-tenant++rdoc-image-3Ahttps-3A-2F-2Fimg.shields.io-2Fgem-2Fv-2Factiverecord-multi-tenant.svg++rdoc-image-3Ahttps-3A-2F-2Fimg.shields.io-2Fgem-2Fdt-2Factiverecord-multi-tenant.svg">activerecord-multi-tenant <a href="https://rubygems.org/gems/activerecord-multi-tenant"> rdoc-image:https://img.shields.io/gem/v/activerecord-multi-tenant.svg</a> <a href="https://rubygems.org/gems/activerecord-multi-tenant"> rdoc-image:https://img.shields.io/gem/dt/activerecord-multi-tenant.svg</a></h1>
|
62
|
+
|
63
|
+
<p>Introduction Post: <a href="https://www.citusdata.com/blog/2017/01/05/easily-scale-out-multi-tenant-apps">www.citusdata.com/blog/2017/01/05/easily-scale-out-multi-tenant-apps</a>/</p>
|
64
|
+
|
65
|
+
<p>ActiveRecord/Rails integration for multi-tenant databases, in particular the open-source <a href="https://github.com/citusdata/citus">Citus</a> extension for PostgreSQL.</p>
|
66
|
+
|
67
|
+
<p>Enables easy scale-out by adding the tenant context to your queries, enabling the database (e.g. Citus) to efficiently route queries to the right database node.</p>
|
68
|
+
|
69
|
+
<h2 id="label-Installation">Installation</h2>
|
70
|
+
|
71
|
+
<p>Add the following to your Gemfile:</p>
|
72
|
+
|
73
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>activerecord-multi-tenant</span><span class='tstring_end'>'</span></span>
|
74
|
+
</code></pre>
|
75
|
+
|
76
|
+
<h2 id="label-Supported+Rails+versions">Supported Rails versions</h2>
|
77
|
+
|
78
|
+
<p>All Ruby on Rails versions starting with 6.0 or newer (up to 7.0) are supported.</p>
|
79
|
+
|
80
|
+
<p>This gem only supports ActiveRecord (the Rails default ORM), and not alternative ORMs like Sequel.</p>
|
81
|
+
|
82
|
+
<h2 id="label-Usage">Usage</h2>
|
83
|
+
|
84
|
+
<p>It is required that you add <code>multi_tenant</code> definitions to your model in order to have full support for Citus, in particular when updating records.</p>
|
85
|
+
|
86
|
+
<p>In the example of an analytics application, sharding on <code>customer_id</code>, annotate your models like this:</p>
|
87
|
+
|
88
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>PageView</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="ActiveRecord.html" title="ActiveRecord (module)">ActiveRecord</a></span></span><span class='op'>::</span><span class='const'>Base</span>
|
89
|
+
<span class='id identifier rubyid_multi_tenant'>multi_tenant</span> <span class='symbol'>:customer</span>
|
90
|
+
<span class='id identifier rubyid_belongs_to'>belongs_to</span> <span class='symbol'>:site</span>
|
91
|
+
|
92
|
+
<span class='comment'># ...
|
93
|
+
</span><span class='kw'>end</span>
|
94
|
+
|
95
|
+
<span class='kw'>class</span> <span class='const'>Site</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="ActiveRecord.html" title="ActiveRecord (module)">ActiveRecord</a></span></span><span class='op'>::</span><span class='const'>Base</span>
|
96
|
+
<span class='id identifier rubyid_multi_tenant'>multi_tenant</span> <span class='symbol'>:customer</span>
|
97
|
+
<span class='id identifier rubyid_has_many'>has_many</span> <span class='symbol'>:page_views</span>
|
98
|
+
|
99
|
+
<span class='comment'># ...
|
100
|
+
</span><span class='kw'>end</span>
|
101
|
+
</code></pre>
|
102
|
+
|
103
|
+
<p>and then wrap all code that runs queries/modifications in blocks like this:</p>
|
104
|
+
|
105
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_customer'>customer</span> <span class='op'>=</span> <span class='const'>Customer</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='lbracket'>[</span><span class='symbol'>:current_customer_id</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
106
|
+
<span class='comment'># ...
|
107
|
+
</span><span class='const'><span class='object_link'><a href="MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span><span class='period'>.</span><span class='id identifier rubyid_with'><span class='object_link'><a href="MultiTenant.html#with-class_method" title="MultiTenant.with (method)">with</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_customer'>customer</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
108
|
+
<span class='id identifier rubyid_site'>site</span> <span class='op'>=</span> <span class='const'>Site</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:site_id</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
109
|
+
<span class='id identifier rubyid_site'>site</span><span class='period'>.</span><span class='id identifier rubyid_update!'>update!</span> <span class='label'>last_accessed_at:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
110
|
+
<span class='id identifier rubyid_site'>site</span><span class='period'>.</span><span class='id identifier rubyid_page_views'>page_views</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
|
111
|
+
<span class='kw'>end</span>
|
112
|
+
</code></pre>
|
113
|
+
|
114
|
+
<p>Inside controllers you can use a before_action together with set_current_tenant, to set the tenant for the current request:</p>
|
115
|
+
|
116
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>ApplicationController</span> <span class='op'><</span> <span class='const'>ActionController</span><span class='op'>::</span><span class='const'>Base</span>
|
117
|
+
<span class='id identifier rubyid_set_current_tenant_through_filter'>set_current_tenant_through_filter</span> <span class='comment'># Required to opt into this behavior
|
118
|
+
</span> <span class='id identifier rubyid_before_action'>before_action</span> <span class='symbol'>:set_customer_as_tenant</span>
|
119
|
+
|
120
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_customer_as_tenant'>set_customer_as_tenant</span>
|
121
|
+
<span class='id identifier rubyid_customer'>customer</span> <span class='op'>=</span> <span class='const'>Customer</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='lbracket'>[</span><span class='symbol'>:current_customer_id</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
122
|
+
<span class='id identifier rubyid_set_current_tenant'>set_current_tenant</span><span class='lparen'>(</span><span class='id identifier rubyid_customer'>customer</span><span class='rparen'>)</span>
|
123
|
+
<span class='kw'>end</span>
|
124
|
+
<span class='kw'>end</span>
|
125
|
+
</code></pre>
|
126
|
+
|
127
|
+
<h2 id="label-Rolling+out+activerecord-multi-tenant+for+your+application+-28write-only+mode-29">Rolling out activerecord-multi-tenant for your application (write-only mode)</h2>
|
128
|
+
|
129
|
+
<p>The library relies on tenant_id to be present and NOT NULL for all rows. However, its often useful to have the library set the tenant_id for new records, and then backfilling tenant_id for existing records as a background task.</p>
|
130
|
+
|
131
|
+
<p>To support this, there is a write-only mode, in which tenant_id is not included in queries, but only set for new records. Include the following in an initializer to enable it:</p>
|
132
|
+
|
133
|
+
<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span><span class='period'>.</span><span class='id identifier rubyid_enable_write_only_mode'><span class='object_link'><a href="MultiTenant.html#enable_write_only_mode-class_method" title="MultiTenant.enable_write_only_mode (method)">enable_write_only_mode</a></span></span>
|
134
|
+
</code></pre>
|
135
|
+
|
136
|
+
<p>Once you are ready to enforce tenancy, make your tenant_id column NOT NULL and simply remove that line.</p>
|
137
|
+
|
138
|
+
<h2 id="label-Frequently+Asked+Questions">Frequently Asked Questions</h2>
|
139
|
+
<ul><li>
|
140
|
+
<p><strong>What if I have a table that doesn’t relate to my tenant?</strong> (e.g. templates that are the same in every account)</p>
|
141
|
+
</li></ul>
|
142
|
+
|
143
|
+
<p>We recommend not using activerecord-multi-tenant on these tables. In case only some records in a table are not associated to a tenant (i.e. your templates are in the same table as actual objects), we recommend setting the tenant_id to 0, and then using MultiTenant.with(0) to access these objects.</p>
|
144
|
+
<ul><li>
|
145
|
+
<p><strong>What if my tenant model is not defined in my application?</strong></p>
|
146
|
+
</li></ul>
|
147
|
+
|
148
|
+
<p>The tenant model does not have to be defined. Use the gem as if the model was present. <code>MultiTenant.with</code> accepts either a tenant id or model instance.</p>
|
149
|
+
|
150
|
+
<h2 id="label-Credits">Credits</h2>
|
151
|
+
|
152
|
+
<p>This gem was initially based on <a href="https://github.com/ErwinM/acts_as_tenant">acts_as_tenant</a>, and still shares some code. We thank the authors for their efforts.</p>
|
153
|
+
|
154
|
+
<h2 id="label-License">License</h2>
|
155
|
+
|
156
|
+
<p>Copyright © 2018, Citus Data Inc.<br> Licensed under the MIT license, see LICENSE file for details.</p>
|
157
|
+
</div></div>
|
158
|
+
|
159
|
+
<div id="footer">
|
160
|
+
Generated on Sat May 27 10:16:23 2023 by
|
161
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
162
|
+
0.9.34 (ruby-3.2.2).
|
163
|
+
</div>
|
164
|
+
|
165
|
+
</div>
|
166
|
+
</body>
|
167
|
+
</html>
|