activerecord-multi-tenant 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/active-record-multi-tenant-tests.yml +80 -0
  3. data/.gitignore +6 -0
  4. data/.readthedocs.yaml +15 -0
  5. data/.rspec +0 -0
  6. data/.rubocop.yml +51 -0
  7. data/Appraisals +0 -0
  8. data/CHANGELOG.md +6 -0
  9. data/Gemfile +3 -1
  10. data/LICENSE +0 -0
  11. data/README.md +2 -1
  12. data/Rakefile +1 -1
  13. data/activerecord-multi-tenant.gemspec +28 -22
  14. data/docker-compose.yml +24 -18
  15. data/docs/.gitignore +3 -0
  16. data/docs/Makefile +28 -0
  17. data/docs/api-reference.sh +10 -0
  18. data/docs/requirements.in +4 -0
  19. data/docs/requirements.txt +62 -0
  20. data/docs/source/_static/api-reference/ActiveRecord/Associations/Association.html +285 -0
  21. data/docs/source/_static/api-reference/ActiveRecord/Associations/ClassMethods.html +255 -0
  22. data/docs/source/_static/api-reference/ActiveRecord/Associations.html +117 -0
  23. data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters/SchemaStatements.html +232 -0
  24. data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters.html +126 -0
  25. data/docs/source/_static/api-reference/ActiveRecord/QueryMethods.html +336 -0
  26. data/docs/source/_static/api-reference/ActiveRecord/SchemaDumper.html +121 -0
  27. data/docs/source/_static/api-reference/ActiveRecord.html +130 -0
  28. data/docs/source/_static/api-reference/MultiTenant/ArelTenantVisitor.html +755 -0
  29. data/docs/source/_static/api-reference/MultiTenant/ArelVisitorsDepthFirst.html +208 -0
  30. data/docs/source/_static/api-reference/MultiTenant/BaseTenantEnforcementClause.html +462 -0
  31. data/docs/source/_static/api-reference/MultiTenant/Context.html +659 -0
  32. data/docs/source/_static/api-reference/MultiTenant/ControllerExtensions.html +202 -0
  33. data/docs/source/_static/api-reference/MultiTenant/CopyFromClient.html +186 -0
  34. data/docs/source/_static/api-reference/MultiTenant/CopyFromClientHelper.html +362 -0
  35. data/docs/source/_static/api-reference/MultiTenant/Current.html +124 -0
  36. data/docs/source/_static/api-reference/MultiTenant/DatabaseStatements.html +366 -0
  37. data/docs/source/_static/api-reference/MultiTenant/FastTruncate.html +226 -0
  38. data/docs/source/_static/api-reference/MultiTenant/MigrationExtensions.html +554 -0
  39. data/docs/source/_static/api-reference/MultiTenant/MissingTenantError.html +124 -0
  40. data/docs/source/_static/api-reference/MultiTenant/ModelExtensionsClassMethods.html +492 -0
  41. data/docs/source/_static/api-reference/MultiTenant/QueryMonitor.html +257 -0
  42. data/docs/source/_static/api-reference/MultiTenant/Table.html +419 -0
  43. data/docs/source/_static/api-reference/MultiTenant/TenantEnforcementClause.html +148 -0
  44. data/docs/source/_static/api-reference/MultiTenant/TenantIsImmutable.html +135 -0
  45. data/docs/source/_static/api-reference/MultiTenant/TenantJoinEnforcementClause.html +310 -0
  46. data/docs/source/_static/api-reference/MultiTenant/TenantValueVisitor.html +239 -0
  47. data/docs/source/_static/api-reference/MultiTenant.html +1454 -0
  48. data/docs/source/_static/api-reference/MultiTenantFindBy.html +180 -0
  49. data/docs/source/_static/api-reference/Sidekiq/Client.html +302 -0
  50. data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Client.html +217 -0
  51. data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Server.html +219 -0
  52. data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant.html +126 -0
  53. data/docs/source/_static/api-reference/Sidekiq.html +126 -0
  54. data/docs/source/_static/api-reference/_index.html +399 -0
  55. data/docs/source/_static/api-reference/class_list.html +51 -0
  56. data/docs/source/_static/api-reference/css/common.css +1 -0
  57. data/docs/source/_static/api-reference/css/full_list.css +58 -0
  58. data/docs/source/_static/api-reference/css/style.css +497 -0
  59. data/docs/source/_static/api-reference/file.README.html +167 -0
  60. data/docs/source/_static/api-reference/file_list.html +56 -0
  61. data/docs/source/_static/api-reference/frames.html +17 -0
  62. data/docs/source/_static/api-reference/index.html +167 -0
  63. data/docs/source/_static/api-reference/js/app.js +314 -0
  64. data/docs/source/_static/api-reference/js/full_list.js +216 -0
  65. data/docs/source/_static/api-reference/js/jquery.js +4 -0
  66. data/docs/source/_static/api-reference/method_list.html +715 -0
  67. data/docs/source/_static/api-reference/top-level-namespace.html +126 -0
  68. data/docs/source/_templates/.gitignore +4 -0
  69. data/docs/source/api-reference.rst +8 -0
  70. data/docs/source/appendix.rst +26 -0
  71. data/docs/source/changelog.rst +8 -0
  72. data/docs/source/community-and-support.rst +26 -0
  73. data/docs/source/conf.py +30 -0
  74. data/docs/source/contributing.rst +70 -0
  75. data/docs/source/getting-started.rst +37 -0
  76. data/docs/source/guides-and-tutorials.rst +129 -0
  77. data/docs/source/index.rst +54 -0
  78. data/docs/source/introduction.rst +33 -0
  79. data/docs/source/license.rst +22 -0
  80. data/docs/source/troubleshooting.rst +41 -0
  81. data/docs/source/usage-guide.rst +59 -0
  82. data/lib/activerecord-multi-tenant/arel_visitors_depth_first.rb +183 -174
  83. data/lib/activerecord-multi-tenant/controller_extensions.rb +15 -4
  84. data/lib/activerecord-multi-tenant/copy_from_client.rb +4 -0
  85. data/lib/activerecord-multi-tenant/fast_truncate.rb +4 -2
  86. data/lib/activerecord-multi-tenant/habtm.rb +50 -0
  87. data/lib/activerecord-multi-tenant/migrations.rb +18 -8
  88. data/lib/activerecord-multi-tenant/model_extensions.rb +78 -37
  89. data/lib/activerecord-multi-tenant/multi_tenant.rb +40 -21
  90. data/lib/activerecord-multi-tenant/query_monitor.rb +21 -5
  91. data/lib/activerecord-multi-tenant/query_rewriter.rb +111 -80
  92. data/lib/activerecord-multi-tenant/sidekiq.rb +31 -20
  93. data/lib/activerecord-multi-tenant/version.rb +1 -1
  94. data/lib/activerecord-multi-tenant.rb +3 -12
  95. data/lib/activerecord_multi_tenant.rb +12 -0
  96. data/spec/activerecord-multi-tenant/associations_spec.rb +21 -0
  97. data/spec/activerecord-multi-tenant/controller_extensions_spec.rb +3 -2
  98. data/spec/activerecord-multi-tenant/fast_truncate_spec.rb +8 -6
  99. data/spec/activerecord-multi-tenant/model_extensions_spec.rb +233 -153
  100. data/spec/activerecord-multi-tenant/multi_tenant_spec.rb +15 -13
  101. data/spec/activerecord-multi-tenant/query_rewriter_spec.rb +60 -59
  102. data/spec/activerecord-multi-tenant/record_callback_spec.rb +0 -0
  103. data/spec/activerecord-multi-tenant/record_finding_spec.rb +11 -11
  104. data/spec/activerecord-multi-tenant/record_modifications_spec.rb +4 -4
  105. data/spec/activerecord-multi-tenant/sidekiq_spec.rb +10 -10
  106. data/spec/database.yml +0 -0
  107. data/spec/schema.rb +20 -2
  108. data/spec/spec_helper.rb +46 -17
  109. data/spec/support/format_sql.rb +20 -0
  110. metadata +130 -25
  111. data/.github/workflows/CI.yml +0 -47
  112. data/gemfiles/.bundle/config +0 -2
  113. data/gemfiles/active_record_6.0.gemfile +0 -8
  114. data/gemfiles/active_record_6.1.gemfile +0 -8
  115. data/gemfiles/active_record_7.0.gemfile +0 -8
  116. data/gemfiles/rails_6.0.gemfile +0 -8
  117. data/gemfiles/rails_6.1.gemfile +0 -8
  118. data/gemfiles/rails_7.0.gemfile +0 -8
  119. data/lib/activerecord-multi-tenant/with_lock.rb +0 -15
  120. data/spec/activerecord-multi-tenant/schema_dumper_tester.rb +0 -0
@@ -0,0 +1,336 @@
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
+ Module: ActiveRecord::QueryMethods
8
+
9
+ &mdash; 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 = "ActiveRecord::QueryMethods";
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="../class_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 (Q)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../ActiveRecord.html" title="ActiveRecord (module)">ActiveRecord</a></span></span>
41
+ &raquo;
42
+ <span class="title">QueryMethods</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: ActiveRecord::QueryMethods
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/activerecord-multi-tenant/query_rewriter.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <h2>
95
+ Instance Method Summary
96
+ <small><a href="#" class="summary_toggle">collapse</a></small>
97
+ </h2>
98
+
99
+ <ul class="summary">
100
+
101
+ <li class="public ">
102
+ <span class="summary_signature">
103
+
104
+ <a href="#build_arel-instance_method" title="#build_arel (instance method)">#<strong>build_arel</strong>(*args) &#x21d2; Object </a>
105
+
106
+
107
+
108
+ </span>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <span class="summary_desc"><div class='inline'></div></span>
119
+
120
+ </li>
121
+
122
+
123
+ <li class="public ">
124
+ <span class="summary_signature">
125
+
126
+ <a href="#build_arel_orig-instance_method" title="#build_arel_orig (instance method)">#<strong>build_arel_orig</strong> &#x21d2; Object </a>
127
+
128
+
129
+
130
+ </span>
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <span class="summary_desc"><div class='inline'></div></span>
141
+
142
+ </li>
143
+
144
+
145
+ </ul>
146
+
147
+
148
+
149
+
150
+ <div id="instance_method_details" class="method_details_list">
151
+ <h2>Instance Method Details</h2>
152
+
153
+
154
+ <div class="method_details first">
155
+ <h3 class="signature first" id="build_arel-instance_method">
156
+
157
+ #<strong>build_arel</strong>(*args) &#x21d2; <tt>Object</tt>
158
+
159
+
160
+
161
+
162
+
163
+ </h3><table class="source_code">
164
+ <tr>
165
+ <td>
166
+ <pre class="lines">
167
+
168
+
169
+ 288
170
+ 289
171
+ 290
172
+ 291
173
+ 292
174
+ 293
175
+ 294
176
+ 295
177
+ 296
178
+ 297
179
+ 298
180
+ 299
181
+ 300
182
+ 301
183
+ 302
184
+ 303
185
+ 304
186
+ 305
187
+ 306
188
+ 307
189
+ 308
190
+ 309
191
+ 310
192
+ 311
193
+ 312
194
+ 313
195
+ 314
196
+ 315
197
+ 316
198
+ 317
199
+ 318
200
+ 319
201
+ 320
202
+ 321
203
+ 322
204
+ 323
205
+ 324
206
+ 325
207
+ 326
208
+ 327
209
+ 328
210
+ 329
211
+ 330
212
+ 331
213
+ 332
214
+ 333
215
+ 334
216
+ 335
217
+ 336
218
+ 337
219
+ 338
220
+ 339
221
+ 340
222
+ 341
223
+ 342
224
+ 343
225
+ 344
226
+ 345
227
+ 346
228
+ 347</pre>
229
+ </td>
230
+ <td>
231
+ <pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 288</span>
232
+
233
+ <span class='kw'>def</span> <span class='id identifier rubyid_build_arel'>build_arel</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
234
+ <span class='id identifier rubyid_arel'>arel</span> <span class='op'>=</span> <span class='id identifier rubyid_build_arel_orig'>build_arel_orig</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
235
+
236
+ <span class='kw'>unless</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_write_only_mode_enabled?'><span class='object_link'><a href="../MultiTenant.html#with_write_only_mode_enabled%3F-class_method" title="MultiTenant.with_write_only_mode_enabled? (method)">with_write_only_mode_enabled?</a></span></span>
237
+ <span class='id identifier rubyid_visitor'>visitor</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../MultiTenant/ArelTenantVisitor.html" title="MultiTenant::ArelTenantVisitor (class)">ArelTenantVisitor</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../MultiTenant/ArelTenantVisitor.html#initialize-instance_method" title="MultiTenant::ArelTenantVisitor#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_arel'>arel</span><span class='rparen'>)</span>
238
+
239
+ <span class='id identifier rubyid_visitor'>visitor</span><span class='period'>.</span><span class='id identifier rubyid_contexts'>contexts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_context'>context</span><span class='op'>|</span>
240
+ <span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_arel_node'>arel_node</span>
241
+
242
+ <span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_unhandled_relations'>unhandled_relations</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_relation'>relation</span><span class='op'>|</span>
243
+ <span class='id identifier rubyid_model'>model</span> <span class='op'>=</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_multi_tenant_model_for_table'><span class='object_link'><a href="../MultiTenant.html#multi_tenant_model_for_table-class_method" title="MultiTenant.multi_tenant_model_for_table (method)">multi_tenant_model_for_table</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_relation'>relation</span><span class='period'>.</span><span class='id identifier rubyid_arel_table'>arel_table</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
244
+
245
+ <span class='kw'>if</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_current_tenant_id'><span class='object_link'><a href="../MultiTenant.html#current_tenant_id-class_method" title="MultiTenant.current_tenant_id (method)">current_tenant_id</a></span></span>
246
+ <span class='id identifier rubyid_enforcement_clause'>enforcement_clause</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../MultiTenant/TenantEnforcementClause.html" title="MultiTenant::TenantEnforcementClause (class)">TenantEnforcementClause</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../MultiTenant/BaseTenantEnforcementClause.html#initialize-instance_method" title="MultiTenant::BaseTenantEnforcementClause#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_relation'>relation</span><span class='period'>.</span><span class='id identifier rubyid_arel_table'>arel_table</span><span class='lbracket'>[</span><span class='id identifier rubyid_model'>model</span><span class='period'>.</span><span class='id identifier rubyid_partition_key'>partition_key</span><span class='rbracket'>]</span><span class='rparen'>)</span>
247
+ <span class='kw'>case</span> <span class='id identifier rubyid_node'>node</span>
248
+ <span class='kw'>when</span> <span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>Join</span> <span class='comment'># Arel::Nodes::OuterJoin, Arel::Nodes::RightOuterJoin, Arel::Nodes::FullOuterJoin
249
+ </span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_right'>right</span><span class='period'>.</span><span class='id identifier rubyid_expr'>expr</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_right'>right</span><span class='period'>.</span><span class='id identifier rubyid_expr'>expr</span><span class='period'>.</span><span class='id identifier rubyid_and'>and</span><span class='lparen'>(</span><span class='id identifier rubyid_enforcement_clause'>enforcement_clause</span><span class='rparen'>)</span>
250
+ <span class='kw'>when</span> <span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>SelectCore</span>
251
+ <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_wheres'>wheres</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
252
+ <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_wheres'>wheres</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_enforcement_clause'>enforcement_clause</span><span class='rbracket'>]</span>
253
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_wheres'>wheres</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>And</span><span class='rparen'>)</span>
254
+ <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_wheres'>wheres</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_children'>children</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_enforcement_clause'>enforcement_clause</span>
255
+ <span class='kw'>else</span>
256
+ <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_wheres'>wheres</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_enforcement_clause'>enforcement_clause</span><span class='period'>.</span><span class='id identifier rubyid_and'>and</span><span class='lparen'>(</span><span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_wheres'>wheres</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
257
+ <span class='kw'>end</span>
258
+ <span class='kw'>else</span>
259
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UnknownContext</span><span class='tstring_end'>&#39;</span></span>
260
+ <span class='kw'>end</span>
261
+ <span class='kw'>end</span>
262
+
263
+ <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>SelectCore</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>Join</span><span class='rparen'>)</span>
264
+
265
+ <span class='id identifier rubyid_node_list'>node_list</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>Join</span>
266
+ <span class='lbracket'>[</span><span class='id identifier rubyid_node'>node</span><span class='rbracket'>]</span>
267
+ <span class='kw'>else</span>
268
+ <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_right'>right</span>
269
+ <span class='kw'>end</span>
270
+
271
+ <span class='id identifier rubyid_node_list'>node_list</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Arel</span><span class='op'>::</span><span class='const'>Nodes</span><span class='op'>::</span><span class='const'>Join</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_node_join'>node_join</span><span class='op'>|</span>
272
+ <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_node_join'>node_join</span><span class='period'>.</span><span class='id identifier rubyid_right'>right</span>
273
+
274
+ <span class='id identifier rubyid_relation_right'>relation_right</span><span class='comma'>,</span> <span class='id identifier rubyid_relation_left'>relation_left</span> <span class='op'>=</span> <span class='id identifier rubyid_relations_from_node_join'>relations_from_node_join</span><span class='lparen'>(</span><span class='id identifier rubyid_node_join'>node_join</span><span class='rparen'>)</span>
275
+
276
+ <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_relation_right'>relation_right</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_relation_left'>relation_left</span>
277
+
278
+ <span class='id identifier rubyid_model_right'>model_right</span> <span class='op'>=</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_multi_tenant_model_for_table'><span class='object_link'><a href="../MultiTenant.html#multi_tenant_model_for_table-class_method" title="MultiTenant.multi_tenant_model_for_table (method)">multi_tenant_model_for_table</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_relation_left'>relation_left</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
279
+ <span class='id identifier rubyid_model_left'>model_left</span> <span class='op'>=</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_multi_tenant_model_for_table'><span class='object_link'><a href="../MultiTenant.html#multi_tenant_model_for_table-class_method" title="MultiTenant.multi_tenant_model_for_table (method)">multi_tenant_model_for_table</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_relation_right'>relation_right</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
280
+ <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_model_right'>model_right</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_model_left'>model_left</span>
281
+
282
+ <span class='id identifier rubyid_join_enforcement_clause'>join_enforcement_clause</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../MultiTenant/TenantJoinEnforcementClause.html" title="MultiTenant::TenantJoinEnforcementClause (class)">TenantJoinEnforcementClause</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../MultiTenant/TenantJoinEnforcementClause.html#initialize-instance_method" title="MultiTenant::TenantJoinEnforcementClause#initialize (method)">new</a></span></span><span class='lparen'>(</span>
283
+ <span class='id identifier rubyid_relation_right'>relation_right</span><span class='lbracket'>[</span><span class='id identifier rubyid_model_right'>model_right</span><span class='period'>.</span><span class='id identifier rubyid_partition_key'>partition_key</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_relation_left'>relation_left</span>
284
+ <span class='rparen'>)</span>
285
+ <span class='id identifier rubyid_node_join'>node_join</span><span class='period'>.</span><span class='id identifier rubyid_right'>right</span><span class='period'>.</span><span class='id identifier rubyid_expr'>expr</span> <span class='op'>=</span> <span class='id identifier rubyid_node_join'>node_join</span><span class='period'>.</span><span class='id identifier rubyid_right'>right</span><span class='period'>.</span><span class='id identifier rubyid_expr'>expr</span><span class='period'>.</span><span class='id identifier rubyid_and'>and</span><span class='lparen'>(</span><span class='id identifier rubyid_join_enforcement_clause'>join_enforcement_clause</span><span class='rparen'>)</span>
286
+ <span class='kw'>end</span>
287
+ <span class='kw'>end</span>
288
+ <span class='kw'>end</span>
289
+ <span class='kw'>end</span>
290
+
291
+ <span class='id identifier rubyid_arel'>arel</span>
292
+ <span class='kw'>end</span></pre>
293
+ </td>
294
+ </tr>
295
+ </table>
296
+ </div>
297
+
298
+ <div class="method_details ">
299
+ <h3 class="signature " id="build_arel_orig-instance_method">
300
+
301
+ #<strong>build_arel_orig</strong> &#x21d2; <tt>Object</tt>
302
+
303
+
304
+
305
+
306
+
307
+ </h3><table class="source_code">
308
+ <tr>
309
+ <td>
310
+ <pre class="lines">
311
+
312
+
313
+ 286</pre>
314
+ </td>
315
+ <td>
316
+ <pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 286</span>
317
+
318
+ <span class='kw'>alias</span> <span class='id identifier rubyid_build_arel_orig'>build_arel_orig</span> <span class='id identifier rubyid_build_arel'>build_arel</span></pre>
319
+ </td>
320
+ </tr>
321
+ </table>
322
+ </div>
323
+
324
+ </div>
325
+
326
+ </div>
327
+
328
+ <div id="footer">
329
+ Generated on Sat May 27 10:16:24 2023 by
330
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
331
+ 0.9.34 (ruby-3.2.2).
332
+ </div>
333
+
334
+ </div>
335
+ </body>
336
+ </html>
@@ -0,0 +1,121 @@
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
+ Class: ActiveRecord::SchemaDumper
8
+
9
+ &mdash; 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 = "ActiveRecord::SchemaDumper";
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="../class_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 (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../ActiveRecord.html" title="ActiveRecord (module)">ActiveRecord</a></span></span>
41
+ &raquo;
42
+ <span class="title">SchemaDumper</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: ActiveRecord::SchemaDumper
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">ActiveRecord::SchemaDumper</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/activerecord-multi-tenant/migrations.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ </div>
112
+
113
+ <div id="footer">
114
+ Generated on Sat May 27 10:16:24 2023 by
115
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
116
+ 0.9.34 (ruby-3.2.2).
117
+ </div>
118
+
119
+ </div>
120
+ </body>
121
+ </html>
@@ -0,0 +1,130 @@
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
+ Module: ActiveRecord
8
+
9
+ &mdash; 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 = "ActiveRecord";
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="class_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)</a> &raquo;
40
+
41
+
42
+ <span class="title">ActiveRecord</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: ActiveRecord
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/activerecord-multi-tenant/habtm.rb<span class="defines">,<br />
82
+ lib/activerecord-multi-tenant/query_rewriter.rb,<br /> lib/activerecord-multi-tenant/migrations.rb,<br /> lib/activerecord-multi-tenant/migrations.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>This module extension is a monkey patch to the ActiveRecord::Associations::ClassMethods module. It overrides the has_and_belongs_to_many method to add the tenant_id to the join table if the tenant_enabled option is set to true.</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div><h2>Defined Under Namespace</h2>
100
+ <p class="children">
101
+
102
+
103
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="ActiveRecord/Associations.html" title="ActiveRecord::Associations (module)">Associations</a></span>, <span class='object_link'><a href="ActiveRecord/ConnectionAdapters.html" title="ActiveRecord::ConnectionAdapters (module)">ConnectionAdapters</a></span>, <span class='object_link'><a href="ActiveRecord/QueryMethods.html" title="ActiveRecord::QueryMethods (module)">QueryMethods</a></span>
104
+
105
+
106
+
107
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="ActiveRecord/SchemaDumper.html" title="ActiveRecord::SchemaDumper (class)">SchemaDumper</a></span>
108
+
109
+
110
+ </p>
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ </div>
121
+
122
+ <div id="footer">
123
+ Generated on Sat May 27 10:16:23 2023 by
124
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
125
+ 0.9.34 (ruby-3.2.2).
126
+ </div>
127
+
128
+ </div>
129
+ </body>
130
+ </html>