anchormodel 0.0.2 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +206 -0
  6. data/README.md +98 -9
  7. data/Rakefile +23 -3
  8. data/anchormodel.gemspec +26 -10
  9. data/bin/rails +7 -0
  10. data/doc/Anchormodel/ActiveModelTypeValue.html +14 -10
  11. data/doc/Anchormodel/Attribute.html +75 -71
  12. data/doc/Anchormodel/ModelMixin.html +190 -21
  13. data/doc/Anchormodel/Version.html +4 -4
  14. data/doc/Anchormodel.html +151 -53
  15. data/doc/_index.html +2 -2
  16. data/doc/file.README.html +118 -47
  17. data/doc/index.html +118 -47
  18. data/doc/method_list.html +9 -1
  19. data/doc/top-level-namespace.html +2 -2
  20. data/lib/anchormodel/active_model_type_value.rb +4 -4
  21. data/lib/anchormodel/attribute.rb +4 -9
  22. data/lib/anchormodel/model_mixin.rb +53 -3
  23. data/lib/anchormodel/version.rb +2 -2
  24. data/lib/anchormodel.rb +7 -2
  25. data/logo.svg +98 -0
  26. data/test/active_record_model/user_test.rb +115 -0
  27. data/test/dummy/.gitignore +29 -0
  28. data/test/dummy/Rakefile +6 -0
  29. data/test/dummy/app/anchormodels/locale.rb +6 -0
  30. data/test/dummy/app/anchormodels/role.rb +14 -0
  31. data/test/dummy/app/helpers/application_helper.rb +2 -0
  32. data/test/dummy/app/models/application_record.rb +5 -0
  33. data/test/dummy/app/models/concerns/.keep +0 -0
  34. data/test/dummy/app/models/user.rb +6 -0
  35. data/test/dummy/bin/rails +4 -0
  36. data/test/dummy/bin/rake +4 -0
  37. data/test/dummy/bin/setup +33 -0
  38. data/test/dummy/config/application.rb +37 -0
  39. data/test/dummy/config/boot.rb +3 -0
  40. data/test/dummy/config/credentials.yml.enc +1 -0
  41. data/test/dummy/config/database.yml +8 -0
  42. data/test/dummy/config/environment.rb +5 -0
  43. data/test/dummy/config/environments/test.rb +50 -0
  44. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  45. data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  46. data/test/dummy/config/initializers/inflections.rb +16 -0
  47. data/test/dummy/config/initializers/permissions_policy.rb +11 -0
  48. data/test/dummy/config/locales/en.yml +33 -0
  49. data/test/dummy/config/puma.rb +43 -0
  50. data/test/dummy/config/routes.rb +6 -0
  51. data/test/dummy/config.ru +6 -0
  52. data/test/dummy/db/migrate/20230107173151_create_users.rb +12 -0
  53. data/test/dummy/db/schema.rb +23 -0
  54. data/test/dummy/db/seeds.rb +7 -0
  55. data/test/dummy/lib/tasks/.keep +0 -0
  56. data/test/dummy/log/.keep +0 -0
  57. data/test/dummy/tmp/.keep +0 -0
  58. data/test/dummy/tmp/pids/.keep +0 -0
  59. data/test/test_helper.rb +21 -0
  60. metadata +149 -13
  61. data/anchormodel-0.0.1.gem +0 -0
@@ -90,7 +90,8 @@
90
90
 
91
91
  <h2>Overview</h2><div class="docstring">
92
92
  <div class="discussion">
93
- <p>All Rails models making use of #belongs_to_anchormodel must include this mixin. Typically, it is included in <code>application_record.rb</code>.</p>
93
+
94
+ <p>All Rails models making use of #belongs_to_anchormodel must include this mixin. Typically, it is included in <code>application_record.rb</code>.</p>
94
95
 
95
96
 
96
97
  </div>
@@ -116,7 +117,7 @@
116
117
  <li class="public ">
117
118
  <span class="summary_signature">
118
119
 
119
- <a href="#belongs_to_anchormodel-class_method" title="belongs_to_anchormodel (class method)">.<strong>belongs_to_anchormodel</strong>(attribute_name, anchor_class_name = nil, optional: false) &#x21d2; Object </a>
120
+ <a href="#belongs_to_anchormodel-class_method" title="belongs_to_anchormodel (class method)">.<strong>belongs_to_anchormodel</strong>(attribute_name, anchormodel_class = nil, optional: false, model_readers: true, model_writers: true, model_scopes: true, model_methods: nil) &#x21d2; Object </a>
120
121
 
121
122
 
122
123
 
@@ -130,7 +131,8 @@
130
131
 
131
132
 
132
133
 
133
- <span class="summary_desc"><div class='inline'><p>Creates an attribute linking to an Anchormodel.</p>
134
+ <span class="summary_desc"><div class='inline'>
135
+ <p>Creates an attribute linking to an Anchormodel.</p>
134
136
  </div></span>
135
137
 
136
138
  </li>
@@ -149,7 +151,7 @@
149
151
  <div class="method_details first">
150
152
  <h3 class="signature first" id="belongs_to_anchormodel-class_method">
151
153
 
152
- .<strong>belongs_to_anchormodel</strong>(attribute_name, anchor_class_name = nil, optional: false) &#x21d2; <tt>Object</tt>
154
+ .<strong>belongs_to_anchormodel</strong>(attribute_name, anchormodel_class = nil, optional: false, model_readers: true, model_writers: true, model_scopes: true, model_methods: nil) &#x21d2; <tt>Object</tt>
153
155
 
154
156
 
155
157
 
@@ -157,8 +159,8 @@
157
159
 
158
160
  </h3><div class="docstring">
159
161
  <div class="discussion">
160
- <p>Creates an attribute linking to an Anchormodel. The attribute should be
161
- present in the DB and the column should be named the same as <code>attribute_name.</code></p>
162
+
163
+ <p>Creates an attribute linking to an Anchormodel. The attribute should be present in the DB and the column should be named the same as <code>attribute_name.</code></p>
162
164
 
163
165
 
164
166
  </div>
@@ -177,24 +179,26 @@ present in the DB and the column should be named the same as <code>attribute_nam
177
179
 
178
180
 
179
181
  &mdash;
180
- <div class='inline'><p>The name and database column of the attribute</p>
182
+ <div class='inline'>
183
+ <p>The name and database column of the attribute</p>
181
184
  </div>
182
185
 
183
186
  </li>
184
187
 
185
188
  <li>
186
189
 
187
- <span class='name'>anchor_class_name</span>
190
+ <span class='name'>anchormodel_class</span>
188
191
 
189
192
 
190
- <span class='type'>(<tt>String</tt>)</span>
193
+ <span class='type'>(<tt>Class</tt>)</span>
191
194
 
192
195
 
193
196
  <em class="default">(defaults to: <tt>nil</tt>)</em>
194
197
 
195
198
 
196
199
  &mdash;
197
- <div class='inline'><p>Name of the Anchormodel class (omit if attribute <code>:foo_bar</code> holds an <code>Anchormodels::FooBar</code>)</p>
200
+ <div class='inline'>
201
+ <p>Class of the Anchormodel (omit if attribute <code>:foo_bar</code> holds a <code>FooBar</code>)</p>
198
202
  </div>
199
203
 
200
204
  </li>
@@ -211,7 +215,80 @@ present in the DB and the column should be named the same as <code>attribute_nam
211
215
 
212
216
 
213
217
  &mdash;
214
- <div class='inline'><p>If true, a presence validation is added to the model.</p>
218
+ <div class='inline'>
219
+ <p>If true, a presence validation is added to the model.</p>
220
+ </div>
221
+
222
+ </li>
223
+
224
+ <li>
225
+
226
+ <span class='name'>model_readers</span>
227
+
228
+
229
+ <span class='type'>(<tt>Boolean</tt>)</span>
230
+
231
+
232
+ <em class="default">(defaults to: <tt>true</tt>)</em>
233
+
234
+
235
+ &mdash;
236
+ <div class='inline'>
237
+ <p>If true, the model is given an ActiveRecord::Enum style method <code>my_model.my_key?</code> reader for each key in the anchormodel</p>
238
+ </div>
239
+
240
+ </li>
241
+
242
+ <li>
243
+
244
+ <span class='name'>model_writers</span>
245
+
246
+
247
+ <span class='type'>(<tt>Boolean</tt>)</span>
248
+
249
+
250
+ <em class="default">(defaults to: <tt>true</tt>)</em>
251
+
252
+
253
+ &mdash;
254
+ <div class='inline'>
255
+ <p>If true, the model is given an ActiveRecord::Enum style method <code>my_model.my_key!</code> writer for each key in the anchormodel</p>
256
+ </div>
257
+
258
+ </li>
259
+
260
+ <li>
261
+
262
+ <span class='name'>model_scopes</span>
263
+
264
+
265
+ <span class='type'>(<tt>Boolean</tt>)</span>
266
+
267
+
268
+ <em class="default">(defaults to: <tt>true</tt>)</em>
269
+
270
+
271
+ &mdash;
272
+ <div class='inline'>
273
+ <p>If true, the model is given an ActiveRecord::Enum style scope <code>MyModel.mykey</code> for each key in the anchormodel</p>
274
+ </div>
275
+
276
+ </li>
277
+
278
+ <li>
279
+
280
+ <span class='name'>model_methods</span>
281
+
282
+
283
+ <span class='type'>(<tt>Boolean</tt>, <tt>NilClass</tt>)</span>
284
+
285
+
286
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
287
+
288
+
289
+ &mdash;
290
+ <div class='inline'>
291
+ <p>If non-nil, this mass-assigns and overrides <code>model_readers</code>, <code>model_writers</code> and <code>model_scopes</code></p>
215
292
  </div>
216
293
 
217
294
  </li>
@@ -225,10 +302,6 @@ present in the DB and the column should be named the same as <code>attribute_nam
225
302
  <pre class="lines">
226
303
 
227
304
 
228
- 16
229
- 17
230
- 18
231
- 19
232
305
  20
233
306
  21
234
307
  22
@@ -253,14 +326,73 @@ present in the DB and the column should be named the same as <code>attribute_nam
253
326
  41
254
327
  42
255
328
  43
256
- 44</pre>
329
+ 44
330
+ 45
331
+ 46
332
+ 47
333
+ 48
334
+ 49
335
+ 50
336
+ 51
337
+ 52
338
+ 53
339
+ 54
340
+ 55
341
+ 56
342
+ 57
343
+ 58
344
+ 59
345
+ 60
346
+ 61
347
+ 62
348
+ 63
349
+ 64
350
+ 65
351
+ 66
352
+ 67
353
+ 68
354
+ 69
355
+ 70
356
+ 71
357
+ 72
358
+ 73
359
+ 74
360
+ 75
361
+ 76
362
+ 77
363
+ 78
364
+ 79
365
+ 80
366
+ 81
367
+ 82
368
+ 83
369
+ 84
370
+ 85
371
+ 86
372
+ 87
373
+ 88
374
+ 89
375
+ 90
376
+ 91
377
+ 92
378
+ 93
379
+ 94</pre>
257
380
  </td>
258
381
  <td>
259
- <pre class="code"><span class="info file"># File 'lib/anchormodel/model_mixin.rb', line 16</span>
382
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/model_mixin.rb', line 20</span>
260
383
 
261
- <span class='kw'>def</span> <span class='id identifier rubyid_belongs_to_anchormodel'>belongs_to_anchormodel</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='comma'>,</span> <span class='id identifier rubyid_anchor_class_name'>anchor_class_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>optional:</span> <span class='kw'>false</span><span class='rparen'>)</span>
384
+ <span class='kw'>def</span> <span class='id identifier rubyid_belongs_to_anchormodel'>belongs_to_anchormodel</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='comma'>,</span> <span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>optional:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>model_readers:</span> <span class='kw'>true</span><span class='comma'>,</span>
385
+ <span class='label'>model_writers:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>model_scopes:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>model_methods:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
386
+ <span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span> <span class='op'>||=</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_classify'>classify</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span>
262
387
  <span class='id identifier rubyid_attribute_name'>attribute_name</span> <span class='op'>=</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
263
- <span class='id identifier rubyid_attribute'>attribute</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Anchormodel.html" title="Anchormodel (class)">Anchormodel</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Attribute.html" title="Anchormodel::Attribute (class)">Attribute</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Attribute.html#initialize-instance_method" title="Anchormodel::Attribute#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='comma'>,</span> <span class='id identifier rubyid_anchor_class_name'>anchor_class_name</span><span class='comma'>,</span> <span class='id identifier rubyid_optional'>optional</span><span class='rparen'>)</span>
388
+ <span class='id identifier rubyid_attribute'>attribute</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Anchormodel.html" title="Anchormodel (class)">Anchormodel</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Attribute.html" title="Anchormodel::Attribute (class)">Attribute</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Attribute.html#initialize-instance_method" title="Anchormodel::Attribute#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='comma'>,</span> <span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='comma'>,</span> <span class='id identifier rubyid_optional'>optional</span><span class='rparen'>)</span>
389
+
390
+ <span class='comment'># Mass configurations if model_methods was specfied
391
+ </span> <span class='kw'>unless</span> <span class='id identifier rubyid_model_methods'>model_methods</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
392
+ <span class='id identifier rubyid_model_readers'>model_readers</span> <span class='op'>=</span> <span class='id identifier rubyid_model_methods'>model_methods</span>
393
+ <span class='id identifier rubyid_model_writers'>model_writers</span> <span class='op'>=</span> <span class='id identifier rubyid_model_methods'>model_methods</span>
394
+ <span class='id identifier rubyid_model_scopes'>model_scopes</span> <span class='op'>=</span> <span class='id identifier rubyid_model_methods'>model_methods</span>
395
+ <span class='kw'>end</span>
264
396
 
265
397
  <span class='comment'># Register attribute
266
398
  </span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_attributes'>anchormodel_attributes</span> <span class='op'>=</span> <span class='id identifier rubyid_anchormodel_attributes'>anchormodel_attributes</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_attribute'>attribute</span> <span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
@@ -286,6 +418,43 @@ present in the DB and the column should be named the same as <code>attribute_nam
286
418
 
287
419
  <span class='comment'># Supply serializer and deserializer
288
420
  </span> <span class='id identifier rubyid_attribute'>attribute</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='comma'>,</span> <span class='id identifier rubyid_active_model_type_value'>active_model_type_value</span>
421
+
422
+ <span class='comment'># Create ActiveRecord::Enum style reader directly in the model if asked to do so
423
+ </span> <span class='comment'># For a model User with anchormodel Role with keys :admin and :guest, this creates user.admin? and user.guest? (returning true iff role is admin/guest)
424
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_model_readers'>model_readers</span>
425
+ <span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</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_entry'>entry</span><span class='op'>|</span>
426
+ <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:&quot;#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>?</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
427
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Anchormodel reader </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>? already defined for </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>, add `model_readers: false` to `belongs_to_anchormodel :</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>`.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
428
+ <span class='kw'>end</span>
429
+ <span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:&quot;#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>?</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
430
+ <span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='id identifier rubyid_entry'>entry</span>
431
+ <span class='kw'>end</span>
432
+ <span class='kw'>end</span>
433
+ <span class='kw'>end</span>
434
+
435
+ <span class='comment'># Create ActiveRecord::Enum style writer directly in the model if asked to do so
436
+ </span> <span class='comment'># For a model User with anchormodel Role with keys :admin and :guest, this creates user.admin! and user.guest! (setting the role to admin/guest)
437
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_model_writers'>model_writers</span>
438
+ <span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</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_entry'>entry</span><span class='op'>|</span>
439
+ <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:&quot;#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
440
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Anchormodel writer </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>! already defined for </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>, add `model_writers: false` to `belongs_to_anchormodel :</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>`.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
441
+ <span class='kw'>end</span>
442
+ <span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:&quot;#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
443
+ <span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='symbol'>:&quot;#{</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_entry'>entry</span><span class='rparen'>)</span>
444
+ <span class='kw'>end</span>
445
+ <span class='kw'>end</span>
446
+ <span class='kw'>end</span>
447
+
448
+ <span class='comment'># Create ActiveRecord::Enum style scope directly in the model class if asked to do so
449
+ </span> <span class='comment'># For a model User with anchormodel Role with keys :admin and :guest, this creates user.admin! and user.guest! (setting the role to admin/guest)
450
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_model_scopes'>model_scopes</span>
451
+ <span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</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_entry'>entry</span><span class='op'>|</span>
452
+ <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
453
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Anchormodel scope </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'> already defined for </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>, add `model_scopes: false` to `belongs_to_anchormodel :</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>`.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
454
+ <span class='kw'>end</span>
455
+ <span class='id identifier rubyid_scope'>scope</span><span class='lparen'>(</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='tlambda'>-&gt;</span><span class='tlambeg'>{</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute_name'>attribute_name</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='rparen'>)</span>
456
+ <span class='kw'>end</span>
457
+ <span class='kw'>end</span>
289
458
  <span class='kw'>end</span></pre>
290
459
  </td>
291
460
  </tr>
@@ -297,9 +466,9 @@ present in the DB and the column should be named the same as <code>attribute_nam
297
466
  </div>
298
467
 
299
468
  <div id="footer">
300
- Generated on Sat Dec 17 12:56:00 2022 by
469
+ Generated on Tue Jan 24 20:27:59 2023 by
301
470
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
302
- 0.9.28 (ruby-3.0.4).
471
+ 0.9.28 (ruby-3.1.3).
303
472
  </div>
304
473
 
305
474
  </div>
@@ -127,7 +127,7 @@
127
127
 
128
128
  </div>
129
129
  </dt>
130
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
130
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
131
131
 
132
132
  <dt id="PATCH-constant" class="">PATCH =
133
133
  <div class="docstring">
@@ -155,7 +155,7 @@
155
155
 
156
156
  </div>
157
157
  </dt>
158
- <dd><pre class="code"><span class='kw'>true</span></pre></dd>
158
+ <dd><pre class="code"><span class='kw'>false</span></pre></dd>
159
159
 
160
160
  <dt id="LABEL-constant" class="">LABEL =
161
161
  <div class="docstring">
@@ -185,9 +185,9 @@
185
185
  </div>
186
186
 
187
187
  <div id="footer">
188
- Generated on Sat Dec 17 12:56:00 2022 by
188
+ Generated on Tue Jan 24 20:27:59 2023 by
189
189
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
190
- 0.9.28 (ruby-3.0.4).
190
+ 0.9.28 (ruby-3.1.3).
191
191
  </div>
192
192
 
193
193
  </div>