anchormodel 0.2.4 → 0.2.6
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/CHANGELOG.md +9 -0
- data/VERSION +1 -1
- data/anchormodel.gemspec +4 -4
- data/doc/Anchormodel/ActiveModelTypeValueMulti.html +1 -1
- data/doc/Anchormodel/ActiveModelTypeValueSingle.html +1 -1
- data/doc/Anchormodel/Attribute.html +1 -1
- data/doc/Anchormodel/ModelMixin.html +1 -1
- data/doc/Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html +25 -3
- data/doc/Anchormodel/SimpleFormInputs/Helpers.html +1 -1
- data/doc/Anchormodel/SimpleFormInputs.html +1 -1
- data/doc/Anchormodel/Util.html +15 -3
- data/doc/Anchormodel/Version.html +1 -1
- data/doc/Anchormodel.html +62 -1
- data/doc/AnchormodelCheckBoxesInput.html +1 -1
- data/doc/AnchormodelGenerator.html +1 -1
- data/doc/AnchormodelInput.html +1 -1
- data/doc/AnchormodelRadioButtonsInput.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +35 -27
- data/doc/top-level-namespace.html +1 -1
- data/lib/anchormodel/simple_form_inputs/helpers/anchormodel_inputs_common.rb +12 -1
- data/lib/anchormodel/util.rb +7 -1
- data/lib/anchormodel.rb +4 -0
- metadata +3 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdf9540f2e782e151e9b60e99561a213da014a23a257d6bd5d04e4694a540638
|
4
|
+
data.tar.gz: 7f86a064ee2d94b66c66102e81ef2a2ee3997cc46557fe806c4970a733672c7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1419bbd9cce3bc457517cc4a923abad741c1dfac03bec80f739889648659acaa10116c183a656a0cb4d9214ff9fce266e62575c80e44e2a52f37d0a9fa4d6d
|
7
|
+
data.tar.gz: 305d35380def57b2a5c945bc72712f40291ea1a7b4f91eeb90204cf1be9bd2aa71b808bd2bdab32e61a2fd969ed3557ce2518f94ef4bc4b11f3585e96c2c345e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 0.2.6
|
2
|
+
|
3
|
+
- Enhance support for custom collections in inputs
|
4
|
+
|
5
|
+
# 0.2.5
|
6
|
+
|
7
|
+
- Fix an issue in combination with the active_type gem, causing virtual models to always read nil on anchormodel attributes
|
8
|
+
- When serializing an Anchormodel to json, return the key
|
9
|
+
|
1
10
|
# 0.2.4 (06.11.2024)
|
2
11
|
|
3
12
|
- Implement `YourConstant.first` as a shorthand for `YourConstant.all.first` to avoid Rubocop problems
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/anchormodel.gemspec
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
# This file is auto-generated via: 'rake gemspec'.
|
3
3
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: anchormodel 0.2.
|
5
|
+
# stub: anchormodel 0.2.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "anchormodel".freeze
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.6".freeze
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Sandro Kalbermatter".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "1980-01-02"
|
15
15
|
s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "anchormodel.gemspec".freeze, "bin/rails".freeze, "doc/Anchormodel.html".freeze, "doc/Anchormodel/ActiveModelTypeValue.html".freeze, "doc/Anchormodel/ActiveModelTypeValueMulti.html".freeze, "doc/Anchormodel/ActiveModelTypeValueSingle.html".freeze, "doc/Anchormodel/Attribute.html".freeze, "doc/Anchormodel/ModelMixin.html".freeze, "doc/Anchormodel/SimpleFormInputs.html".freeze, "doc/Anchormodel/SimpleFormInputs/Helpers.html".freeze, "doc/Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html".freeze, "doc/Anchormodel/Util.html".freeze, "doc/Anchormodel/Version.html".freeze, "doc/AnchormodelCheckBoxesInput.html".freeze, "doc/AnchormodelGenerator.html".freeze, "doc/AnchormodelInput.html".freeze, "doc/AnchormodelRadioButtonsInput.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/anchormodel.rb".freeze, "lib/anchormodel/active_model_type_value_multi.rb".freeze, "lib/anchormodel/active_model_type_value_single.rb".freeze, "lib/anchormodel/attribute.rb".freeze, "lib/anchormodel/model_mixin.rb".freeze, "lib/anchormodel/simple_form_inputs/anchormodel_check_boxes_input.rb".freeze, "lib/anchormodel/simple_form_inputs/anchormodel_input.rb".freeze, "lib/anchormodel/simple_form_inputs/anchormodel_radio_buttons_input.rb".freeze, "lib/anchormodel/simple_form_inputs/helpers/anchormodel_inputs_common.rb".freeze, "lib/anchormodel/util.rb".freeze, "lib/anchormodel/version.rb".freeze, "lib/generators/anchormodel/USAGE".freeze, "lib/generators/anchormodel/anchormodel_generator.rb".freeze, "lib/generators/anchormodel/templates/anchormodel.rb.erb".freeze, "logo.svg".freeze, "test/active_record_model/user_test.rb".freeze, "test/dummy/.gitignore".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/anchormodels/animal.rb".freeze, "test/dummy/app/anchormodels/locale.rb".freeze, "test/dummy/app/anchormodels/role.rb".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/credentials.yml.enc".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/initializers/content_security_policy.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/permissions_policy.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/db/migrate/20230107173151_create_users.rb".freeze, "test/dummy/db/migrate/20240425182000_add_animals_to_users.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/db/seeds.rb".freeze, "test/dummy/lib/tasks/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/tmp/.keep".freeze, "test/dummy/tmp/pids/.keep".freeze, "test/test_helper.rb".freeze]
|
16
16
|
s.homepage = "https://github.com/kalsan/anchormodel".freeze
|
17
17
|
s.licenses = ["LGPL-3.0-or-later".freeze]
|
18
18
|
s.required_ruby_version = Gem::Requirement.new(">= 3.0.0".freeze)
|
19
|
-
s.rubygems_version = "3.
|
19
|
+
s.rubygems_version = "3.6.9".freeze
|
20
20
|
s.summary = "Bringing object-oriented programming to Rails enums".freeze
|
21
21
|
|
22
22
|
s.specification_version = 4
|
@@ -400,7 +400,7 @@
|
|
400
400
|
</div>
|
401
401
|
|
402
402
|
<div id="footer">
|
403
|
-
Generated on
|
403
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
404
404
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
405
405
|
0.9.37 (ruby-3.3.5).
|
406
406
|
</div>
|
@@ -687,7 +687,7 @@
|
|
687
687
|
</div>
|
688
688
|
|
689
689
|
<div id="footer">
|
690
|
-
Generated on
|
690
|
+
Generated on Thu Aug 7 15:55:30 2025 by
|
691
691
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
692
692
|
0.9.37 (ruby-3.3.5).
|
693
693
|
</div>
|
@@ -596,7 +596,7 @@
|
|
596
596
|
</div>
|
597
597
|
|
598
598
|
<div id="footer">
|
599
|
-
Generated on
|
599
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
600
600
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
601
601
|
0.9.37 (ruby-3.3.5).
|
602
602
|
</div>
|
@@ -273,7 +273,7 @@
|
|
273
273
|
</div>
|
274
274
|
|
275
275
|
<div id="footer">
|
276
|
-
Generated on
|
276
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
277
277
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
278
278
|
0.9.37 (ruby-3.3.5).
|
279
279
|
</div>
|
@@ -210,7 +210,18 @@
|
|
210
210
|
45
|
211
211
|
46
|
212
212
|
47
|
213
|
-
48
|
213
|
+
48
|
214
|
+
49
|
215
|
+
50
|
216
|
+
51
|
217
|
+
52
|
218
|
+
53
|
219
|
+
54
|
220
|
+
55
|
221
|
+
56
|
222
|
+
57
|
223
|
+
58
|
224
|
+
59</pre>
|
214
225
|
</td>
|
215
226
|
<td>
|
216
227
|
<pre class="code"><span class="info file"># File 'lib/anchormodel/simple_form_inputs/helpers/anchormodel_inputs_common.rb', line 5</span>
|
@@ -253,7 +264,18 @@ Affected object: </span><span class='embexpr_beg'>#{</span><span class='id ident
|
|
253
264
|
<span class='id identifier rubyid_sf_selection_key'>sf_selection_key</span> <span class='op'>=></span> <span class='id identifier rubyid_selected_key'>selected_key</span>
|
254
265
|
<span class='rparen'>)</span>
|
255
266
|
|
256
|
-
<span class='
|
267
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span>
|
268
|
+
<span class='comment'># Case where collection is given as an option consisting of an array of pairs
|
269
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Enumerable</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='op'>&.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>2</span>
|
270
|
+
<span class='ivar'>@collection</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span>
|
271
|
+
<span class='kw'>else</span>
|
272
|
+
<span class='comment'># Case where collection is given as an option consisting of an array of anchormodels
|
273
|
+
</span> <span class='ivar'>@collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
274
|
+
<span class='kw'>end</span>
|
275
|
+
<span class='kw'>else</span>
|
276
|
+
<span class='comment'># Case where collection is not given
|
277
|
+
</span> <span class='ivar'>@collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='id identifier rubyid_am_class'>am_class</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='rparen'>)</span>
|
278
|
+
<span class='kw'>end</span>
|
257
279
|
|
258
280
|
<span class='id identifier rubyid_before_render_input'>before_render_input</span>
|
259
281
|
|
@@ -269,7 +291,7 @@ Affected object: </span><span class='embexpr_beg'>#{</span><span class='id ident
|
|
269
291
|
</div>
|
270
292
|
|
271
293
|
<div id="footer">
|
272
|
-
Generated on
|
294
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
273
295
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
274
296
|
0.9.37 (ruby-3.3.5).
|
275
297
|
</div>
|
@@ -114,7 +114,7 @@
|
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div id="footer">
|
117
|
-
Generated on
|
117
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
118
118
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
119
119
|
0.9.37 (ruby-3.3.5).
|
120
120
|
</div>
|
@@ -114,7 +114,7 @@
|
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div id="footer">
|
117
|
-
Generated on
|
117
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
118
118
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
119
119
|
0.9.37 (ruby-3.3.5).
|
120
120
|
</div>
|
data/doc/Anchormodel/Util.html
CHANGED
@@ -458,7 +458,13 @@
|
|
458
458
|
139
|
459
459
|
140
|
460
460
|
141
|
461
|
-
142
|
461
|
+
142
|
462
|
+
143
|
463
|
+
144
|
464
|
+
145
|
465
|
+
146
|
466
|
+
147
|
467
|
+
148</pre>
|
462
468
|
</td>
|
463
469
|
<td>
|
464
470
|
<pre class="code"><span class="info file"># File 'lib/anchormodel/util.rb', line 14</span>
|
@@ -497,7 +503,13 @@
|
|
497
503
|
|
498
504
|
<span class='comment'># Overwrite reader to force building anchors at every retrieval
|
499
505
|
</span> <span class='id identifier rubyid_model_class'>model_class</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</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='kw'>do</span>
|
500
|
-
<span class='
|
506
|
+
<span class='comment'># This patch fixes an issue in combination with the active_type gem, causing virtual models to always read nil on anchormodel attributes.
|
507
|
+
</span> <span class='id identifier rubyid_raw_data'>raw_data</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>ActiveType</span><span class='op'>::</span><span class='const'>Object</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>ActiveType</span><span class='op'>::</span><span class='const'>Object</span><span class='rparen'>)</span>
|
508
|
+
<span class='id identifier rubyid_virtual_attributes'>virtual_attributes</span><span class='lbracket'>[</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='rbracket'>]</span>
|
509
|
+
<span class='kw'>else</span>
|
510
|
+
<span class='id identifier rubyid_read_attribute_before_type_cast'>read_attribute_before_type_cast</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='rparen'>)</span>
|
511
|
+
<span class='kw'>end</span>
|
512
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_active_model_type_value'>active_model_type_value</span><span class='period'>.</span><span class='id identifier rubyid_deserialize'>deserialize</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_data'>raw_data</span><span class='rparen'>)</span>
|
501
513
|
|
502
514
|
<span class='comment'># If this attribute holds multiple anchormodels (`belongs_to_anchormodels`), patch the Array before returning in order to implement collection modifiers:
|
503
515
|
</span> <span class='kw'>if</span> <span class='id identifier rubyid_multiple'>multiple</span>
|
@@ -602,7 +614,7 @@
|
|
602
614
|
</div>
|
603
615
|
|
604
616
|
<div id="footer">
|
605
|
-
Generated on
|
617
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
606
618
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
607
619
|
0.9.37 (ruby-3.3.5).
|
608
620
|
</div>
|
@@ -129,7 +129,7 @@
|
|
129
129
|
</div>
|
130
130
|
|
131
131
|
<div id="footer">
|
132
|
-
Generated on
|
132
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
133
133
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
134
134
|
0.9.37 (ruby-3.3.5).
|
135
135
|
</div>
|
data/doc/Anchormodel.html
CHANGED
@@ -344,6 +344,28 @@
|
|
344
344
|
|
345
345
|
|
346
346
|
|
347
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
348
|
+
|
349
|
+
</li>
|
350
|
+
|
351
|
+
|
352
|
+
<li class="public ">
|
353
|
+
<span class="summary_signature">
|
354
|
+
|
355
|
+
<a href="#as_json-instance_method" title="#as_json (instance method)">#<strong>as_json</strong> ⇒ Object </a>
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
</span>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
347
369
|
<span class="summary_desc"><div class='inline'></div></span>
|
348
370
|
|
349
371
|
</li>
|
@@ -938,6 +960,45 @@
|
|
938
960
|
</td>
|
939
961
|
</tr>
|
940
962
|
</table>
|
963
|
+
</div>
|
964
|
+
|
965
|
+
<div class="method_details ">
|
966
|
+
<h3 class="signature " id="as_json-instance_method">
|
967
|
+
|
968
|
+
#<strong>as_json</strong> ⇒ <tt>Object</tt>
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
|
973
|
+
|
974
|
+
</h3><div class="docstring">
|
975
|
+
<div class="discussion">
|
976
|
+
|
977
|
+
|
978
|
+
</div>
|
979
|
+
</div>
|
980
|
+
<div class="tags">
|
981
|
+
|
982
|
+
|
983
|
+
</div><table class="source_code">
|
984
|
+
<tr>
|
985
|
+
<td>
|
986
|
+
<pre class="lines">
|
987
|
+
|
988
|
+
|
989
|
+
89
|
990
|
+
90
|
991
|
+
91</pre>
|
992
|
+
</td>
|
993
|
+
<td>
|
994
|
+
<pre class="code"><span class="info file"># File 'lib/anchormodel.rb', line 89</span>
|
995
|
+
|
996
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span>
|
997
|
+
<span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
998
|
+
<span class='kw'>end</span></pre>
|
999
|
+
</td>
|
1000
|
+
</tr>
|
1001
|
+
</table>
|
941
1002
|
</div>
|
942
1003
|
|
943
1004
|
<div class="method_details ">
|
@@ -1064,7 +1125,7 @@
|
|
1064
1125
|
</div>
|
1065
1126
|
|
1066
1127
|
<div id="footer">
|
1067
|
-
Generated on
|
1128
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
1068
1129
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1069
1130
|
0.9.37 (ruby-3.3.5).
|
1070
1131
|
</div>
|
@@ -130,7 +130,7 @@
|
|
130
130
|
</div>
|
131
131
|
|
132
132
|
<div id="footer">
|
133
|
-
Generated on
|
133
|
+
Generated on Thu Aug 7 15:55:30 2025 by
|
134
134
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
135
135
|
0.9.37 (ruby-3.3.5).
|
136
136
|
</div>
|
@@ -191,7 +191,7 @@
|
|
191
191
|
</div>
|
192
192
|
|
193
193
|
<div id="footer">
|
194
|
-
Generated on
|
194
|
+
Generated on Thu Aug 7 15:55:30 2025 by
|
195
195
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
196
196
|
0.9.37 (ruby-3.3.5).
|
197
197
|
</div>
|
data/doc/AnchormodelInput.html
CHANGED
@@ -130,7 +130,7 @@
|
|
130
130
|
</div>
|
131
131
|
|
132
132
|
<div id="footer">
|
133
|
-
Generated on
|
133
|
+
Generated on Thu Aug 7 15:55:30 2025 by
|
134
134
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
135
135
|
0.9.37 (ruby-3.3.5).
|
136
136
|
</div>
|
@@ -130,7 +130,7 @@
|
|
130
130
|
</div>
|
131
131
|
|
132
132
|
<div id="footer">
|
133
|
-
Generated on
|
133
|
+
Generated on Thu Aug 7 15:55:30 2025 by
|
134
134
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
135
135
|
0.9.37 (ruby-3.3.5).
|
136
136
|
</div>
|
data/doc/_index.html
CHANGED
@@ -220,7 +220,7 @@
|
|
220
220
|
</div>
|
221
221
|
|
222
222
|
<div id="footer">
|
223
|
-
Generated on
|
223
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
224
224
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
225
225
|
0.9.37 (ruby-3.3.5).
|
226
226
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -339,7 +339,7 @@
|
|
339
339
|
</div></div>
|
340
340
|
|
341
341
|
<div id="footer">
|
342
|
-
Generated on
|
342
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
343
343
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
344
344
|
0.9.37 (ruby-3.3.5).
|
345
345
|
</div>
|
data/doc/index.html
CHANGED
@@ -339,7 +339,7 @@
|
|
339
339
|
</div></div>
|
340
340
|
|
341
341
|
<div id="footer">
|
342
|
-
Generated on
|
342
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
343
343
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
344
344
|
0.9.37 (ruby-3.3.5).
|
345
345
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -80,6 +80,14 @@
|
|
80
80
|
|
81
81
|
|
82
82
|
<li class="odd ">
|
83
|
+
<div class="item">
|
84
|
+
<span class='object_link'><a href="Anchormodel.html#as_json-instance_method" title="Anchormodel#as_json (method)">#as_json</a></span>
|
85
|
+
<small>Anchormodel</small>
|
86
|
+
</div>
|
87
|
+
</li>
|
88
|
+
|
89
|
+
|
90
|
+
<li class="even ">
|
83
91
|
<div class="item">
|
84
92
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#attribute-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#attribute (method)">#attribute</a></span>
|
85
93
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -87,7 +95,7 @@
|
|
87
95
|
</li>
|
88
96
|
|
89
97
|
|
90
|
-
<li class="
|
98
|
+
<li class="odd ">
|
91
99
|
<div class="item">
|
92
100
|
<span class='object_link'><a href="Anchormodel/Attribute.html#attribute_name-instance_method" title="Anchormodel::Attribute#attribute_name (method)">#attribute_name</a></span>
|
93
101
|
<small>Anchormodel::Attribute</small>
|
@@ -95,7 +103,7 @@
|
|
95
103
|
</li>
|
96
104
|
|
97
105
|
|
98
|
-
<li class="
|
106
|
+
<li class="even ">
|
99
107
|
<div class="item">
|
100
108
|
<span class='object_link'><a href="Anchormodel/ModelMixin.html#belongs_to_anchormodel-class_method" title="Anchormodel::ModelMixin.belongs_to_anchormodel (method)">belongs_to_anchormodel</a></span>
|
101
109
|
<small>Anchormodel::ModelMixin</small>
|
@@ -103,7 +111,7 @@
|
|
103
111
|
</li>
|
104
112
|
|
105
113
|
|
106
|
-
<li class="
|
114
|
+
<li class="odd ">
|
107
115
|
<div class="item">
|
108
116
|
<span class='object_link'><a href="Anchormodel/ModelMixin.html#belongs_to_anchormodels-class_method" title="Anchormodel::ModelMixin.belongs_to_anchormodels (method)">belongs_to_anchormodels</a></span>
|
109
117
|
<small>Anchormodel::ModelMixin</small>
|
@@ -111,7 +119,7 @@
|
|
111
119
|
</li>
|
112
120
|
|
113
121
|
|
114
|
-
<li class="
|
122
|
+
<li class="even ">
|
115
123
|
<div class="item">
|
116
124
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueMulti.html#cast-instance_method" title="Anchormodel::ActiveModelTypeValueMulti#cast (method)">#cast</a></span>
|
117
125
|
<small>Anchormodel::ActiveModelTypeValueMulti</small>
|
@@ -119,7 +127,7 @@
|
|
119
127
|
</li>
|
120
128
|
|
121
129
|
|
122
|
-
<li class="
|
130
|
+
<li class="odd ">
|
123
131
|
<div class="item">
|
124
132
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#cast-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#cast (method)">#cast</a></span>
|
125
133
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -127,7 +135,7 @@
|
|
127
135
|
</li>
|
128
136
|
|
129
137
|
|
130
|
-
<li class="
|
138
|
+
<li class="even ">
|
131
139
|
<div class="item">
|
132
140
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#changed_in_place%3F-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#changed_in_place? (method)">#changed_in_place?</a></span>
|
133
141
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -135,7 +143,7 @@
|
|
135
143
|
</li>
|
136
144
|
|
137
145
|
|
138
|
-
<li class="
|
146
|
+
<li class="odd ">
|
139
147
|
<div class="item">
|
140
148
|
<span class='object_link'><a href="Anchormodel.html#find-class_method" title="Anchormodel.find (method)">find</a></span>
|
141
149
|
<small>Anchormodel</small>
|
@@ -143,7 +151,7 @@
|
|
143
151
|
</li>
|
144
152
|
|
145
153
|
|
146
|
-
<li class="
|
154
|
+
<li class="even ">
|
147
155
|
<div class="item">
|
148
156
|
<span class='object_link'><a href="Anchormodel.html#first-class_method" title="Anchormodel.first (method)">first</a></span>
|
149
157
|
<small>Anchormodel</small>
|
@@ -151,7 +159,7 @@
|
|
151
159
|
</li>
|
152
160
|
|
153
161
|
|
154
|
-
<li class="
|
162
|
+
<li class="odd ">
|
155
163
|
<div class="item">
|
156
164
|
<span class='object_link'><a href="Anchormodel.html#form_collection-class_method" title="Anchormodel.form_collection (method)">form_collection</a></span>
|
157
165
|
<small>Anchormodel</small>
|
@@ -159,7 +167,7 @@
|
|
159
167
|
</li>
|
160
168
|
|
161
169
|
|
162
|
-
<li class="
|
170
|
+
<li class="even ">
|
163
171
|
<div class="item">
|
164
172
|
<span class='object_link'><a href="Anchormodel.html#index-instance_method" title="Anchormodel#index (method)">#index</a></span>
|
165
173
|
<small>Anchormodel</small>
|
@@ -167,7 +175,7 @@
|
|
167
175
|
</li>
|
168
176
|
|
169
177
|
|
170
|
-
<li class="
|
178
|
+
<li class="odd ">
|
171
179
|
<div class="item">
|
172
180
|
<span class='object_link'><a href="Anchormodel.html#initialize-instance_method" title="Anchormodel#initialize (method)">#initialize</a></span>
|
173
181
|
<small>Anchormodel</small>
|
@@ -175,7 +183,7 @@
|
|
175
183
|
</li>
|
176
184
|
|
177
185
|
|
178
|
-
<li class="
|
186
|
+
<li class="even ">
|
179
187
|
<div class="item">
|
180
188
|
<span class='object_link'><a href="Anchormodel/Attribute.html#initialize-instance_method" title="Anchormodel::Attribute#initialize (method)">#initialize</a></span>
|
181
189
|
<small>Anchormodel::Attribute</small>
|
@@ -183,7 +191,7 @@
|
|
183
191
|
</li>
|
184
192
|
|
185
193
|
|
186
|
-
<li class="
|
194
|
+
<li class="odd ">
|
187
195
|
<div class="item">
|
188
196
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#initialize-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#initialize (method)">#initialize</a></span>
|
189
197
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -191,7 +199,7 @@
|
|
191
199
|
</li>
|
192
200
|
|
193
201
|
|
194
|
-
<li class="
|
202
|
+
<li class="even ">
|
195
203
|
<div class="item">
|
196
204
|
<span class='object_link'><a href="Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html#input-instance_method" title="Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon#input (method)">#input</a></span>
|
197
205
|
<small>Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon</small>
|
@@ -199,7 +207,7 @@
|
|
199
207
|
</li>
|
200
208
|
|
201
209
|
|
202
|
-
<li class="
|
210
|
+
<li class="odd ">
|
203
211
|
<div class="item">
|
204
212
|
<span class='object_link'><a href="Anchormodel.html#inspect-instance_method" title="Anchormodel#inspect (method)">#inspect</a></span>
|
205
213
|
<small>Anchormodel</small>
|
@@ -207,7 +215,7 @@
|
|
207
215
|
</li>
|
208
216
|
|
209
217
|
|
210
|
-
<li class="
|
218
|
+
<li class="even ">
|
211
219
|
<div class="item">
|
212
220
|
<span class='object_link'><a href="Anchormodel/Util.html#install_methods_in_model-class_method" title="Anchormodel::Util.install_methods_in_model (method)">install_methods_in_model</a></span>
|
213
221
|
<small>Anchormodel::Util</small>
|
@@ -215,7 +223,7 @@
|
|
215
223
|
</li>
|
216
224
|
|
217
225
|
|
218
|
-
<li class="
|
226
|
+
<li class="odd ">
|
219
227
|
<div class="item">
|
220
228
|
<span class='object_link'><a href="Anchormodel.html#key-instance_method" title="Anchormodel#key (method)">#key</a></span>
|
221
229
|
<small>Anchormodel</small>
|
@@ -223,7 +231,7 @@
|
|
223
231
|
</li>
|
224
232
|
|
225
233
|
|
226
|
-
<li class="
|
234
|
+
<li class="even ">
|
227
235
|
<div class="item">
|
228
236
|
<span class='object_link'><a href="Anchormodel.html#label-instance_method" title="Anchormodel#label (method)">#label</a></span>
|
229
237
|
<small>Anchormodel</small>
|
@@ -231,7 +239,7 @@
|
|
231
239
|
</li>
|
232
240
|
|
233
241
|
|
234
|
-
<li class="
|
242
|
+
<li class="odd ">
|
235
243
|
<div class="item">
|
236
244
|
<span class='object_link'><a href="Anchormodel/Attribute.html#multiple%3F-instance_method" title="Anchormodel::Attribute#multiple? (method)">#multiple?</a></span>
|
237
245
|
<small>Anchormodel::Attribute</small>
|
@@ -239,7 +247,7 @@
|
|
239
247
|
</li>
|
240
248
|
|
241
249
|
|
242
|
-
<li class="
|
250
|
+
<li class="even ">
|
243
251
|
<div class="item">
|
244
252
|
<span class='object_link'><a href="Anchormodel/Attribute.html#optional-instance_method" title="Anchormodel::Attribute#optional (method)">#optional</a></span>
|
245
253
|
<small>Anchormodel::Attribute</small>
|
@@ -247,7 +255,7 @@
|
|
247
255
|
</li>
|
248
256
|
|
249
257
|
|
250
|
-
<li class="
|
258
|
+
<li class="odd ">
|
251
259
|
<div class="item">
|
252
260
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueMulti.html#serializable%3F-instance_method" title="Anchormodel::ActiveModelTypeValueMulti#serializable? (method)">#serializable?</a></span>
|
253
261
|
<small>Anchormodel::ActiveModelTypeValueMulti</small>
|
@@ -255,7 +263,7 @@
|
|
255
263
|
</li>
|
256
264
|
|
257
265
|
|
258
|
-
<li class="
|
266
|
+
<li class="even ">
|
259
267
|
<div class="item">
|
260
268
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#serializable%3F-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#serializable? (method)">#serializable?</a></span>
|
261
269
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -263,7 +271,7 @@
|
|
263
271
|
</li>
|
264
272
|
|
265
273
|
|
266
|
-
<li class="
|
274
|
+
<li class="odd ">
|
267
275
|
<div class="item">
|
268
276
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueMulti.html#serialize-instance_method" title="Anchormodel::ActiveModelTypeValueMulti#serialize (method)">#serialize</a></span>
|
269
277
|
<small>Anchormodel::ActiveModelTypeValueMulti</small>
|
@@ -271,7 +279,7 @@
|
|
271
279
|
</li>
|
272
280
|
|
273
281
|
|
274
|
-
<li class="
|
282
|
+
<li class="even ">
|
275
283
|
<div class="item">
|
276
284
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#serialize-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#serialize (method)">#serialize</a></span>
|
277
285
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -279,7 +287,7 @@
|
|
279
287
|
</li>
|
280
288
|
|
281
289
|
|
282
|
-
<li class="
|
290
|
+
<li class="odd ">
|
283
291
|
<div class="item">
|
284
292
|
<span class='object_link'><a href="Anchormodel.html#setup!-class_method" title="Anchormodel.setup! (method)">setup!</a></span>
|
285
293
|
<small>Anchormodel</small>
|
@@ -287,7 +295,7 @@
|
|
287
295
|
</li>
|
288
296
|
|
289
297
|
|
290
|
-
<li class="
|
298
|
+
<li class="even ">
|
291
299
|
<div class="item">
|
292
300
|
<span class='object_link'><a href="Anchormodel.html#to_s-instance_method" title="Anchormodel#to_s (method)">#to_s</a></span>
|
293
301
|
<small>Anchormodel</small>
|
@@ -295,7 +303,7 @@
|
|
295
303
|
</li>
|
296
304
|
|
297
305
|
|
298
|
-
<li class="
|
306
|
+
<li class="odd ">
|
299
307
|
<div class="item">
|
300
308
|
<span class='object_link'><a href="Anchormodel/ActiveModelTypeValueSingle.html#type-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#type (method)">#type</a></span>
|
301
309
|
<small>Anchormodel::ActiveModelTypeValueSingle</small>
|
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Thu Aug 7 15:55:29 2025 by
|
104
104
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.9.37 (ruby-3.3.5).
|
106
106
|
</div>
|
@@ -40,7 +40,18 @@ Affected object: #{object.inspect}")
|
|
40
40
|
sf_selection_key => selected_key
|
41
41
|
)
|
42
42
|
|
43
|
-
|
43
|
+
if options[:collection]
|
44
|
+
# Case where collection is given as an option consisting of an array of pairs
|
45
|
+
if options[:collection].first.is_a?(Enumerable) && options[:collection].first&.size == 2
|
46
|
+
@collection = options[:collection]
|
47
|
+
else
|
48
|
+
# Case where collection is given as an option consisting of an array of anchormodels
|
49
|
+
@collection = collect(options[:collection])
|
50
|
+
end
|
51
|
+
else
|
52
|
+
# Case where collection is not given
|
53
|
+
@collection = collect(am_class.all)
|
54
|
+
end
|
44
55
|
|
45
56
|
before_render_input
|
46
57
|
|
data/lib/anchormodel/util.rb
CHANGED
@@ -45,7 +45,13 @@ module Anchormodel::Util
|
|
45
45
|
|
46
46
|
# Overwrite reader to force building anchors at every retrieval
|
47
47
|
model_class.define_method(attribute_name.to_s) do
|
48
|
-
|
48
|
+
# This patch fixes an issue in combination with the active_type gem, causing virtual models to always read nil on anchormodel attributes.
|
49
|
+
raw_data = if defined?(ActiveType::Object) && is_a?(ActiveType::Object)
|
50
|
+
virtual_attributes[attribute_name.to_s]
|
51
|
+
else
|
52
|
+
read_attribute_before_type_cast(attribute_name)
|
53
|
+
end
|
54
|
+
result = active_model_type_value.deserialize(raw_data)
|
49
55
|
|
50
56
|
# If this attribute holds multiple anchormodels (`belongs_to_anchormodels`), patch the Array before returning in order to implement collection modifiers:
|
51
57
|
if multiple
|
data/lib/anchormodel.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anchormodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Kalbermatter
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -150,8 +149,6 @@ dependencies:
|
|
150
149
|
- - "~>"
|
151
150
|
- !ruby/object:Gem::Version
|
152
151
|
version: 1.6.0
|
153
|
-
description:
|
154
|
-
email:
|
155
152
|
executables: []
|
156
153
|
extensions: []
|
157
154
|
extra_rdoc_files: []
|
@@ -252,7 +249,6 @@ homepage: https://github.com/kalsan/anchormodel
|
|
252
249
|
licenses:
|
253
250
|
- LGPL-3.0-or-later
|
254
251
|
metadata: {}
|
255
|
-
post_install_message:
|
256
252
|
rdoc_options: []
|
257
253
|
require_paths:
|
258
254
|
- lib
|
@@ -267,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
263
|
- !ruby/object:Gem::Version
|
268
264
|
version: '0'
|
269
265
|
requirements: []
|
270
|
-
rubygems_version: 3.
|
271
|
-
signing_key:
|
266
|
+
rubygems_version: 3.6.9
|
272
267
|
specification_version: 4
|
273
268
|
summary: Bringing object-oriented programming to Rails enums
|
274
269
|
test_files: []
|