anchormodel 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f7343b6009976e35fa3354eeabe119ad354dd4f103af1d1440251cf178de989
4
- data.tar.gz: b971498fc5b0028c2f43994130abf55b6edfb9be0a327113e5cf099911c5ed78
3
+ metadata.gz: a9eebd14815541c3006409bb03f45b0155db2eb083511a09f228bf57ee68dd8a
4
+ data.tar.gz: a359a0970ec983f9f50de59edb2355fa960db401a03febed48ade509d1e977ae
5
5
  SHA512:
6
- metadata.gz: a3a0b3e80ea3fa4fdec3fa3ade5ce8536a0e8ff00f17019a291646bc307ec6a84a8c5b12c6e247c8bfad51d6bf80df1bec3114ea9edf9b208537c5db28a1a523
7
- data.tar.gz: 14af2506a7729e82c7ed664c61a0523e7dcf2e2595c83078986b6a8d590013dcb543b8e6d641f0b742dc23a9f785cd3585286e5066fb10a6a74dc463cd67ac35
6
+ metadata.gz: 1a4df45b4cbbc8c5235ddd8b52cb1e79639f2d253ffbd627e151fdeef1102584ea9280f0b383f5ac608f395a6b26d946e299b2e810e2609509d1147e2c28f1d5
7
+ data.tar.gz: 90598b9ec18955a30519e8b0fae7e8986f16ecc9c7ee00f8c9d8025118199680e735914527bc3ea35ff3e12800e67f66feacd7695af0951adcc1350063216d72
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.3
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.2.2 (14.08.2024)
2
+
3
+ - Allow passing `anchormodel_attribute` explicitely to `anchormodel` input and enhance error message
4
+ - In `anchormodel` input, fallback to searching selected value in input html options as well
5
+ - Update ruby version to 3.2.2
6
+
7
+ # 0.2.1 (22.05.2024)
8
+
9
+ - Stop enforcing include_blank for SimpleForm, due to https://github.com/heartcombo/simple_form/issues/1427
10
+
1
11
  # 0.2.0 (27.04.2024)
2
12
 
3
13
  - Add support for multiple anchormodels (`belongs_to_anchormodels`)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- anchormodel (0.1.6.edge)
4
+ anchormodel (0.2.2)
5
5
  rails (~> 7.0)
6
6
 
7
7
  GEM
@@ -102,7 +102,7 @@ GEM
102
102
  builder
103
103
  minitest (>= 5.0)
104
104
  ruby-progressbar
105
- net-imap (0.4.10)
105
+ net-imap (0.4.12)
106
106
  date
107
107
  net-protocol
108
108
  net-pop (0.1.2)
@@ -111,8 +111,8 @@ GEM
111
111
  timeout
112
112
  net-smtp (0.5.0)
113
113
  net-protocol
114
- nio4r (2.7.1)
115
- nokogiri (1.16.4-x86_64-linux)
114
+ nio4r (2.7.3)
115
+ nokogiri (1.16.5-x86_64-linux)
116
116
  racc (~> 1.4)
117
117
  parallel (1.22.1)
118
118
  parser (3.2.0.0)
@@ -120,7 +120,7 @@ GEM
120
120
  pry (0.14.1)
121
121
  coderay (~> 1.1)
122
122
  method_source (~> 1.0)
123
- racc (1.7.3)
123
+ racc (1.8.0)
124
124
  rack (2.2.5)
125
125
  rack-test (2.1.0)
126
126
  rack (>= 1.3)
@@ -187,7 +187,7 @@ GEM
187
187
  webrick (~> 1.7.0)
188
188
  yard-activesupport-concern (0.0.1)
189
189
  yard (>= 0.8)
190
- zeitwerk (2.6.13)
190
+ zeitwerk (2.6.15)
191
191
 
192
192
  PLATFORMS
193
193
  x86_64-linux
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.2
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.0 ruby lib
5
+ # stub: anchormodel 0.2.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "anchormodel".freeze
9
- s.version = "0.2.0".freeze
9
+ s.version = "0.2.2".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 = "2024-04-27"
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/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/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]
14
+ s.date = "2024-08-14"
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.5.9".freeze
19
+ s.rubygems_version = "3.5.11".freeze
20
20
  s.summary = "Bringing object-oriented programming to Rails enums".freeze
21
21
 
22
22
  s.specification_version = 4
@@ -0,0 +1,410 @@
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: Anchormodel::ActiveModelTypeValueMulti
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 = "Anchormodel::ActiveModelTypeValueMulti";
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
+ <span class='title'><span class='object_link'><a href="../Anchormodel.html" title="Anchormodel (class)">Anchormodel</a></span></span>
41
+ &raquo;
42
+ <span class="title">ActiveModelTypeValueMulti</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: Anchormodel::ActiveModelTypeValueMulti
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="ActiveModelTypeValueSingle.html" title="Anchormodel::ActiveModelTypeValueSingle (class)">ActiveModelTypeValueSingle</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">ActiveModel::Type::Value</li>
78
+
79
+ <li class="next"><span class='object_link'><a href="ActiveModelTypeValueSingle.html" title="Anchormodel::ActiveModelTypeValueSingle (class)">ActiveModelTypeValueSingle</a></span></li>
80
+
81
+ <li class="next">Anchormodel::ActiveModelTypeValueMulti</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+ </dl>
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <dl>
100
+ <dt>Defined in:</dt>
101
+ <dd>lib/anchormodel/active_model_type_value_multi.rb</dd>
102
+ </dl>
103
+
104
+ </div>
105
+
106
+ <div class="docstring">
107
+ <div class="discussion">
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+
120
+
121
+ <h2>Instance Attribute Summary</h2>
122
+
123
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ActiveModelTypeValueSingle.html" title="Anchormodel::ActiveModelTypeValueSingle (class)">ActiveModelTypeValueSingle</a></span></h3>
124
+ <p class="inherited"><span class='object_link'><a href="ActiveModelTypeValueSingle.html#attribute-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#attribute (method)">#attribute</a></span></p>
125
+
126
+
127
+
128
+ <h2>
129
+ Instance Method Summary
130
+ <small><a href="#" class="summary_toggle">collapse</a></small>
131
+ </h2>
132
+
133
+ <ul class="summary">
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#cast-instance_method" title="#cast (instance method)">#<strong>cast</strong>(values) &#x21d2; Object </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>This converts DB or input to an Anchormodel instance.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#serializable%3F-instance_method" title="#serializable? (instance method)">#<strong>serializable?</strong>(values) &#x21d2; Boolean </a>
163
+
164
+
165
+
166
+ </span>
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ <span class="summary_desc"><div class='inline'></div></span>
177
+
178
+ </li>
179
+
180
+
181
+ <li class="public ">
182
+ <span class="summary_signature">
183
+
184
+ <a href="#serialize-instance_method" title="#serialize (instance method)">#<strong>serialize</strong>(values) &#x21d2; Object </a>
185
+
186
+
187
+
188
+ </span>
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <span class="summary_desc"><div class='inline'>
199
+ <p>This converts an Anchormodel instance to string for DB.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ </ul>
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="ActiveModelTypeValueSingle.html" title="Anchormodel::ActiveModelTypeValueSingle (class)">ActiveModelTypeValueSingle</a></span></h3>
218
+ <p class="inherited"><span class='object_link'><a href="ActiveModelTypeValueSingle.html#changed_in_place%3F-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#changed_in_place? (method)">#changed_in_place?</a></span>, <span class='object_link'><a href="ActiveModelTypeValueSingle.html#initialize-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="ActiveModelTypeValueSingle.html#type-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#type (method)">#type</a></span></p>
219
+
220
+ <div id="constructor_details" class="method_details_list">
221
+ <h2>Constructor Details</h2>
222
+
223
+ <p class="notice">This class inherits a constructor from <span class='object_link'><a href="ActiveModelTypeValueSingle.html#initialize-instance_method" title="Anchormodel::ActiveModelTypeValueSingle#initialize (method)">Anchormodel::ActiveModelTypeValueSingle</a></span></p>
224
+
225
+ </div>
226
+
227
+
228
+ <div id="instance_method_details" class="method_details_list">
229
+ <h2>Instance Method Details</h2>
230
+
231
+
232
+ <div class="method_details first">
233
+ <h3 class="signature first" id="cast-instance_method">
234
+
235
+ #<strong>cast</strong>(values) &#x21d2; <tt>Object</tt>
236
+
237
+
238
+
239
+
240
+
241
+ </h3><div class="docstring">
242
+ <div class="discussion">
243
+
244
+ <p>This converts DB or input to an Anchormodel instance</p>
245
+
246
+
247
+ </div>
248
+ </div>
249
+ <div class="tags">
250
+
251
+
252
+ </div><table class="source_code">
253
+ <tr>
254
+ <td>
255
+ <pre class="lines">
256
+
257
+
258
+ 3
259
+ 4
260
+ 5</pre>
261
+ </td>
262
+ <td>
263
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_multi.rb', line 3</span>
264
+
265
+ <span class='kw'>def</span> <span class='id identifier rubyid_cast'>cast</span><span class='lparen'>(</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
266
+ <span class='kw'>return</span> <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>,</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_to_set'>to_set</span>
267
+ <span class='kw'>end</span></pre>
268
+ </td>
269
+ </tr>
270
+ </table>
271
+ </div>
272
+
273
+ <div class="method_details ">
274
+ <h3 class="signature " id="serializable?-instance_method">
275
+
276
+ #<strong>serializable?</strong>(values) &#x21d2; <tt>Boolean</tt>
277
+
278
+
279
+
280
+
281
+
282
+ </h3><div class="docstring">
283
+ <div class="discussion">
284
+
285
+
286
+ </div>
287
+ </div>
288
+ <div class="tags">
289
+
290
+ <p class="tag_title">Returns:</p>
291
+ <ul class="return">
292
+
293
+ <li>
294
+
295
+
296
+ <span class='type'>(<tt>Boolean</tt>)</span>
297
+
298
+
299
+
300
+ </li>
301
+
302
+ </ul>
303
+
304
+ </div><table class="source_code">
305
+ <tr>
306
+ <td>
307
+ <pre class="lines">
308
+
309
+
310
+ 21
311
+ 22
312
+ 23
313
+ 24
314
+ 25
315
+ 26
316
+ 27
317
+ 28
318
+ 29
319
+ 30</pre>
320
+ </td>
321
+ <td>
322
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_multi.rb', line 21</span>
323
+
324
+ <span class='kw'>def</span> <span class='id identifier rubyid_serializable?'>serializable?</span><span class='lparen'>(</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
325
+ <span class='kw'>return</span> <span class='kw'>case</span> <span class='id identifier rubyid_values'>values</span>
326
+ <span class='kw'>when</span> <span class='const'>Enumerable</span>
327
+ <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>,</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
328
+ <span class='kw'>when</span> <span class='const'>String</span>
329
+ <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>,</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
330
+ <span class='kw'>else</span>
331
+ <span class='kw'>false</span>
332
+ <span class='kw'>end</span>
333
+ <span class='kw'>end</span></pre>
334
+ </td>
335
+ </tr>
336
+ </table>
337
+ </div>
338
+
339
+ <div class="method_details ">
340
+ <h3 class="signature " id="serialize-instance_method">
341
+
342
+ #<strong>serialize</strong>(values) &#x21d2; <tt>Object</tt>
343
+
344
+
345
+
346
+
347
+
348
+ </h3><div class="docstring">
349
+ <div class="discussion">
350
+
351
+ <p>This converts an Anchormodel instance to string for DB</p>
352
+
353
+
354
+ </div>
355
+ </div>
356
+ <div class="tags">
357
+
358
+
359
+ </div><table class="source_code">
360
+ <tr>
361
+ <td>
362
+ <pre class="lines">
363
+
364
+
365
+ 8
366
+ 9
367
+ 10
368
+ 11
369
+ 12
370
+ 13
371
+ 14
372
+ 15
373
+ 16
374
+ 17
375
+ 18
376
+ 19</pre>
377
+ </td>
378
+ <td>
379
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_multi.rb', line 8</span>
380
+
381
+ <span class='kw'>def</span> <span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
382
+ <span class='kw'>return</span> <span class='kw'>case</span> <span class='id identifier rubyid_values'>values</span>
383
+ <span class='kw'>when</span> <span class='const'>Enumerable</span>
384
+ <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>,</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
385
+ <span class='kw'>when</span> <span class='const'>String</span>
386
+ <span class='id identifier rubyid_values'>values</span>
387
+ <span class='kw'>when</span> <span class='kw'>nil</span>
388
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
389
+ <span class='kw'>else</span>
390
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attempt to set </span><span class='embexpr_beg'>#{</span><span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> to unsupported type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
391
+ <span class='kw'>end</span>
392
+ <span class='kw'>end</span></pre>
393
+ </td>
394
+ </tr>
395
+ </table>
396
+ </div>
397
+
398
+ </div>
399
+
400
+ </div>
401
+
402
+ <div id="footer">
403
+ Generated on Wed May 22 11:24:47 2024 by
404
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
405
+ 0.9.34 (ruby-3.2.2).
406
+ </div>
407
+
408
+ </div>
409
+ </body>
410
+ </html>
@@ -687,7 +687,7 @@
687
687
  </div>
688
688
 
689
689
  <div id="footer">
690
- Generated on Sat Apr 27 10:18:33 2024 by
690
+ Generated on Wed May 22 11:24:47 2024 by
691
691
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
692
692
  0.9.34 (ruby-3.2.2).
693
693
  </div>
@@ -596,7 +596,7 @@
596
596
  </div>
597
597
 
598
598
  <div id="footer">
599
- Generated on Sat Apr 27 10:18:33 2024 by
599
+ Generated on Wed May 22 11:24:47 2024 by
600
600
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
601
601
  0.9.34 (ruby-3.2.2).
602
602
  </div>
@@ -106,174 +106,13 @@
106
106
 
107
107
 
108
108
 
109
-
110
- <h2>
111
- Class Method Summary
112
- <small><a href="#" class="summary_toggle">collapse</a></small>
113
- </h2>
114
-
115
- <ul class="summary">
116
-
117
- <li class="public ">
118
- <span class="summary_signature">
119
-
120
- <a href="#belongs_to_anchormodel-class_method" title="belongs_to_anchormodel (class method)">.<strong>belongs_to_anchormodel</strong>(*args, **kwargs) &#x21d2; Object </a>
121
-
122
-
123
-
124
- </span>
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
- <span class="summary_desc"><div class='inline'>
135
- <p>Creates an attribute linking to an Anchormodel.</p>
136
- </div></span>
137
-
138
- </li>
139
-
140
-
141
- <li class="public ">
142
- <span class="summary_signature">
143
-
144
- <a href="#belongs_to_anchormodels-class_method" title="belongs_to_anchormodels (class method)">.<strong>belongs_to_anchormodels</strong>(*args, **kwargs) &#x21d2; Object </a>
145
-
146
-
147
-
148
- </span>
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
- <span class="summary_desc"><div class='inline'>
159
- <p>Creates an attribute linking to an array of Anchormodels.</p>
160
- </div></span>
161
-
162
- </li>
163
-
164
-
165
- </ul>
166
-
167
-
168
-
169
-
170
-
171
- <div id="class_method_details" class="method_details_list">
172
- <h2>Class Method Details</h2>
173
-
174
-
175
- <div class="method_details first">
176
- <h3 class="signature first" id="belongs_to_anchormodel-class_method">
177
-
178
- .<strong>belongs_to_anchormodel</strong>(*args, **kwargs) &#x21d2; <tt>Object</tt>
179
-
180
-
181
-
182
-
183
-
184
- </h3><div class="docstring">
185
- <div class="discussion">
186
-
187
- <p>Creates an attribute linking to an Anchormodel. The attribute should be present in the DB and the column should be of type String and named the same as <code>attribute_name</code>.</p>
188
-
189
-
190
- </div>
191
- </div>
192
- <div class="tags">
193
-
194
-
195
- <p class="tag_title">See Also:</p>
196
- <ul class="see">
197
-
198
- <li>Parameters</li>
199
-
200
- </ul>
201
-
202
- </div><table class="source_code">
203
- <tr>
204
- <td>
205
- <pre class="lines">
206
-
207
-
208
- 14
209
- 15
210
- 16</pre>
211
- </td>
212
- <td>
213
- <pre class="code"><span class="info file"># File 'lib/anchormodel/model_mixin.rb', line 14</span>
214
-
215
- <span class='kw'>def</span> <span class='id identifier rubyid_belongs_to_anchormodel'>belongs_to_anchormodel</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
216
- <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="Util.html" title="Anchormodel::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_install_methods_in_model'><span class='object_link'><a href="Util.html#install_methods_in_model-class_method" title="Anchormodel::Util.install_methods_in_model (method)">install_methods_in_model</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
217
- <span class='kw'>end</span></pre>
218
- </td>
219
- </tr>
220
- </table>
221
- </div>
222
-
223
- <div class="method_details ">
224
- <h3 class="signature " id="belongs_to_anchormodels-class_method">
225
-
226
- .<strong>belongs_to_anchormodels</strong>(*args, **kwargs) &#x21d2; <tt>Object</tt>
227
-
228
-
229
-
230
109
 
231
110
 
232
- </h3><div class="docstring">
233
- <div class="discussion">
234
-
235
- <p>Creates an attribute linking to an array of Anchormodels. The attribute should be present in the DB and the column should be named the singular of <code>attribute_name</code>.</p>
236
-
237
-
238
- </div>
239
- </div>
240
- <div class="tags">
241
-
242
-
243
- <p class="tag_title">See Also:</p>
244
- <ul class="see">
245
-
246
- <li>Parameters</li>
247
-
248
- </ul>
249
-
250
- </div><table class="source_code">
251
- <tr>
252
- <td>
253
- <pre class="lines">
254
-
255
-
256
- 21
257
- 22
258
- 23</pre>
259
- </td>
260
- <td>
261
- <pre class="code"><span class="info file"># File 'lib/anchormodel/model_mixin.rb', line 21</span>
262
-
263
- <span class='kw'>def</span> <span class='id identifier rubyid_belongs_to_anchormodels'>belongs_to_anchormodels</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
264
- <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="Util.html" title="Anchormodel::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_install_methods_in_model'><span class='object_link'><a href="Util.html#install_methods_in_model-class_method" title="Anchormodel::Util.install_methods_in_model (method)">install_methods_in_model</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='label'>multiple:</span> <span class='kw'>true</span><span class='rparen'>)</span>
265
- <span class='kw'>end</span></pre>
266
- </td>
267
- </tr>
268
- </table>
269
- </div>
270
-
271
- </div>
272
111
 
273
112
  </div>
274
113
 
275
114
  <div id="footer">
276
- Generated on Sat Apr 27 10:18:33 2024 by
115
+ Generated on Wed May 22 11:24:47 2024 by
277
116
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
278
117
  0.9.34 (ruby-3.2.2).
279
118
  </div>
@@ -204,8 +204,7 @@
204
204
  39
205
205
  40
206
206
  41
207
- 42
208
- 43</pre>
207
+ 42</pre>
209
208
  </td>
210
209
  <td>
211
210
  <pre class="code"><span class="info file"># File 'lib/anchormodel/simple_form_inputs/helpers/anchormodel_inputs_common.rb', line 5</span>
@@ -239,8 +238,7 @@ Affected object: </span><span class='embexpr_beg'>#{</span><span class='id ident
239
238
  <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_deep_merge!'>deep_merge!</span><span class='lparen'>(</span>
240
239
  <span class='label'>label_method:</span> <span class='symbol'>:first</span><span class='comma'>,</span>
241
240
  <span class='label'>value_method:</span> <span class='symbol'>:second</span><span class='comma'>,</span>
242
- <span class='id identifier rubyid_sf_selection_key'>sf_selection_key</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_selected_key'>selected_key</span><span class='comma'>,</span>
243
- <span class='label'>include_blank:</span> <span class='op'>!</span><span class='id identifier rubyid_am_attr'>am_attr</span><span class='period'>.</span><span class='id identifier rubyid_multiple?'>multiple?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_am_attr'>am_attr</span><span class='period'>.</span><span class='id identifier rubyid_optional'>optional</span>
241
+ <span class='id identifier rubyid_sf_selection_key'>sf_selection_key</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_selected_key'>selected_key</span>
244
242
  <span class='rparen'>)</span>
245
243
 
246
244
  <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>
@@ -259,7 +257,7 @@ Affected object: </span><span class='embexpr_beg'>#{</span><span class='id ident
259
257
  </div>
260
258
 
261
259
  <div id="footer">
262
- Generated on Sat Apr 27 10:18:33 2024 by
260
+ Generated on Wed May 22 11:24:47 2024 by
263
261
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
264
262
  0.9.34 (ruby-3.2.2).
265
263
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sat Apr 27 10:18:33 2024 by
117
+ Generated on Wed May 22 11:24:47 2024 by
118
118
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.34 (ruby-3.2.2).
120
120
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sat Apr 27 10:18:33 2024 by
117
+ Generated on Wed May 22 11:24:47 2024 by
118
118
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.34 (ruby-3.2.2).
120
120
  </div>
@@ -602,7 +602,7 @@
602
602
  </div>
603
603
 
604
604
  <div id="footer">
605
- Generated on Sat Apr 27 10:18:33 2024 by
605
+ Generated on Wed May 22 11:24:47 2024 by
606
606
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
607
607
  0.9.34 (ruby-3.2.2).
608
608
  </div>
@@ -129,7 +129,7 @@
129
129
  </div>
130
130
 
131
131
  <div id="footer">
132
- Generated on Sat Apr 27 10:18:33 2024 by
132
+ Generated on Wed May 22 11:24:47 2024 by
133
133
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
134
  0.9.34 (ruby-3.2.2).
135
135
  </div>
data/doc/Anchormodel.html CHANGED
@@ -999,7 +999,7 @@
999
999
  </div>
1000
1000
 
1001
1001
  <div id="footer">
1002
- Generated on Sat Apr 27 10:18:33 2024 by
1002
+ Generated on Wed May 22 11:24:47 2024 by
1003
1003
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1004
1004
  0.9.34 (ruby-3.2.2).
1005
1005
  </div>
@@ -0,0 +1,140 @@
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: AnchormodelCheckBoxesInput
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 = "AnchormodelCheckBoxesInput";
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">AnchormodelCheckBoxesInput</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: AnchormodelCheckBoxesInput
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">SimpleForm::Inputs::CollectionCheckBoxesInput</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">SimpleForm::Inputs::CollectionCheckBoxesInput</li>
78
+
79
+ <li class="next">AnchormodelCheckBoxesInput</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+ <dl>
93
+ <dt>Includes:</dt>
94
+ <dd><span class='object_link'><a href="Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html" title="Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon (module)">Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon</a></span></dd>
95
+ </dl>
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <dl>
103
+ <dt>Defined in:</dt>
104
+ <dd>lib/anchormodel/simple_form_inputs/anchormodel_check_boxes_input.rb</dd>
105
+ </dl>
106
+
107
+ </div>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <h2>Method Summary</h2>
124
+
125
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html" title="Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon (module)">Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon</a></span></h3>
126
+ <p class="inherited"><span class='object_link'><a href="Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html#input-instance_method" title="Anchormodel::SimpleFormInputs::Helpers::AnchormodelInputsCommon#input (method)">#input</a></span></p>
127
+
128
+
129
+
130
+ </div>
131
+
132
+ <div id="footer">
133
+ Generated on Wed May 22 11:24:47 2024 by
134
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
135
+ 0.9.34 (ruby-3.2.2).
136
+ </div>
137
+
138
+ </div>
139
+ </body>
140
+ </html>
@@ -191,7 +191,7 @@
191
191
  </div>
192
192
 
193
193
  <div id="footer">
194
- Generated on Sat Apr 27 10:18:33 2024 by
194
+ Generated on Wed May 22 11:24:47 2024 by
195
195
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
196
196
  0.9.34 (ruby-3.2.2).
197
197
  </div>
@@ -130,7 +130,7 @@
130
130
  </div>
131
131
 
132
132
  <div id="footer">
133
- Generated on Sat Apr 27 10:18:33 2024 by
133
+ Generated on Wed May 22 11:24:47 2024 by
134
134
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
135
135
  0.9.34 (ruby-3.2.2).
136
136
  </div>
@@ -130,7 +130,7 @@
130
130
  </div>
131
131
 
132
132
  <div id="footer">
133
- Generated on Sat Apr 27 10:18:33 2024 by
133
+ Generated on Wed May 22 11:24:47 2024 by
134
134
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
135
135
  0.9.34 (ruby-3.2.2).
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 Sat Apr 27 10:18:32 2024 by
223
+ Generated on Wed May 22 11:24:46 2024 by
224
224
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
225
225
  0.9.34 (ruby-3.2.2).
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 Sat Apr 27 10:18:33 2024 by
342
+ Generated on Wed May 22 11:24:47 2024 by
343
343
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
344
344
  0.9.34 (ruby-3.2.2).
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 Sat Apr 27 10:18:33 2024 by
342
+ Generated on Wed May 22 11:24:47 2024 by
343
343
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
344
344
  0.9.34 (ruby-3.2.2).
345
345
  </div>
data/doc/method_list.html CHANGED
@@ -92,22 +92,6 @@
92
92
  </li>
93
93
 
94
94
 
95
- <li class="odd ">
96
- <div class="item">
97
- <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>
98
- <small>Anchormodel::ModelMixin</small>
99
- </div>
100
- </li>
101
-
102
-
103
- <li class="even ">
104
- <div class="item">
105
- <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>
106
- <small>Anchormodel::ModelMixin</small>
107
- </div>
108
- </li>
109
-
110
-
111
95
  <li class="odd ">
112
96
  <div class="item">
113
97
  <span class='object_link'><a href="Anchormodel/ActiveModelTypeValueMulti.html#cast-instance_method" title="Anchormodel::ActiveModelTypeValueMulti#cast (method)">#cast</a></span>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Sat Apr 27 10:18:33 2024 by
103
+ Generated on Wed May 22 11:24:47 2024 by
104
104
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.34 (ruby-3.2.2).
106
106
  </div>
@@ -3,12 +3,18 @@ class Anchormodel
3
3
  module Helpers
4
4
  module AnchormodelInputsCommon
5
5
  def input(wrapper_options = nil)
6
- unless object.respond_to?(:anchormodel_attributes)
7
- fail("The form field object does not appear to respond to `anchormodel_attributes`, \
8
- did you `include Anchormodel::ModelMixin` in your `application_record.rb`? Affected object: #{object.inspect}")
6
+ if object.present?
7
+ unless object.respond_to?(:anchormodel_attributes)
8
+ fail("The form field object does not appear to respond to `anchormodel_attributes`, \
9
+ did you `include Anchormodel::ModelMixin` in your `application_record.rb`? Affected object: #{object.inspect}")
10
+ end
11
+ am_attr = object.anchormodel_attributes[@attribute_name]
12
+ elsif options.key?(:anchormodel_attribute)
13
+ am_attr = options.delete(:anchormodel_attribute)
14
+ else
15
+ fail(':anchormodel input requires either an object or the input option :anchormodel_attribute, but neither is set.')
9
16
  end
10
17
 
11
- am_attr = object.anchormodel_attributes[@attribute_name]
12
18
  unless am_attr
13
19
  fail("#{@attribute_name.inspect} does not look like an Anchormodel attribute, is `belongs_to_anchormodel` called in your model? \
14
20
  Affected object: #{object.inspect}")
@@ -17,7 +23,7 @@ Affected object: #{object.inspect}")
17
23
  options[:multiple] = true if am_attr.multiple? && options[:multiple] != false # allow overriding
18
24
 
19
25
  # Attempt to read selected key from html input options "value", as the caller might not know that this is a select.
20
- selected_key = input_options[:value]
26
+ selected_key = input_options[:value].presence || options.dig(:input_html, :value)
21
27
  if selected_key.blank? && object
22
28
  # No selected key override present and a model is present, use the model to find out what to select.
23
29
  selected_am = object.send(@attribute_name)
@@ -31,8 +37,7 @@ Affected object: #{object.inspect}")
31
37
  options.deep_merge!(
32
38
  label_method: :first,
33
39
  value_method: :second,
34
- sf_selection_key => selected_key,
35
- include_blank: !am_attr.multiple? && am_attr.optional
40
+ sf_selection_key => selected_key
36
41
  )
37
42
 
38
43
  @collection = collect(am_class.all)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anchormodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Kalbermatter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-27 00:00:00.000000000 Z
11
+ date: 2024-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -170,6 +170,7 @@ files:
170
170
  - bin/rails
171
171
  - doc/Anchormodel.html
172
172
  - doc/Anchormodel/ActiveModelTypeValue.html
173
+ - doc/Anchormodel/ActiveModelTypeValueMulti.html
173
174
  - doc/Anchormodel/ActiveModelTypeValueSingle.html
174
175
  - doc/Anchormodel/Attribute.html
175
176
  - doc/Anchormodel/ModelMixin.html
@@ -178,6 +179,7 @@ files:
178
179
  - doc/Anchormodel/SimpleFormInputs/Helpers/AnchormodelInputsCommon.html
179
180
  - doc/Anchormodel/Util.html
180
181
  - doc/Anchormodel/Version.html
182
+ - doc/AnchormodelCheckBoxesInput.html
181
183
  - doc/AnchormodelGenerator.html
182
184
  - doc/AnchormodelInput.html
183
185
  - doc/AnchormodelRadioButtonsInput.html
@@ -265,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
267
  - !ruby/object:Gem::Version
266
268
  version: '0'
267
269
  requirements: []
268
- rubygems_version: 3.5.9
270
+ rubygems_version: 3.5.11
269
271
  signing_key:
270
272
  specification_version: 4
271
273
  summary: Bringing object-oriented programming to Rails enums