compony 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 +4 -4
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +3 -3
- data/README.md +1397 -33
- data/Rakefile +6 -2
- data/TODO.md +1 -0
- data/VERSION +1 -0
- data/app/controllers/compony_controller.rb +3 -1
- data/compony.gemspec +7 -7
- data/config/locales/fr.yml +33 -0
- data/doc/ComponentGenerator.html +231 -0
- data/doc/Components.html +105 -0
- data/doc/ComponentsGenerator.html +203 -0
- data/doc/Compony/Component.html +2098 -0
- data/doc/Compony/ComponentMixins/Default/Labelling.html +406 -0
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +539 -0
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +588 -0
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +577 -0
- data/doc/Compony/ComponentMixins/Default/Standalone.html +692 -0
- data/doc/Compony/ComponentMixins/Default.html +126 -0
- data/doc/Compony/ComponentMixins/Resourceful.html +1193 -0
- data/doc/Compony/ComponentMixins.html +126 -0
- data/doc/Compony/Components/Button.html +293 -0
- data/doc/Compony/Components/Destroy.html +384 -0
- data/doc/Compony/Components/Edit.html +462 -0
- data/doc/Compony/Components/Form.html +1112 -0
- data/doc/Compony/Components/New.html +462 -0
- data/doc/Compony/Components/WithForm.html +528 -0
- data/doc/Compony/Components.html +126 -0
- data/doc/Compony/ControllerMixin.html +136 -0
- data/doc/Compony/Engine.html +133 -0
- data/doc/Compony/MethodAccessibleHash.html +453 -0
- data/doc/Compony/ModelFields/Anchormodel.html +383 -0
- data/doc/Compony/ModelFields/Association.html +613 -0
- data/doc/Compony/ModelFields/Attachment.html +305 -0
- data/doc/Compony/ModelFields/Base.html +1066 -0
- data/doc/Compony/ModelFields/Boolean.html +232 -0
- data/doc/Compony/ModelFields/Color.html +299 -0
- data/doc/Compony/ModelFields/Currency.html +232 -0
- data/doc/Compony/ModelFields/Date.html +232 -0
- data/doc/Compony/ModelFields/Datetime.html +232 -0
- data/doc/Compony/ModelFields/Decimal.html +154 -0
- data/doc/Compony/ModelFields/Email.html +240 -0
- data/doc/Compony/ModelFields/Float.html +154 -0
- data/doc/Compony/ModelFields/Integer.html +154 -0
- data/doc/Compony/ModelFields/Percentage.html +232 -0
- data/doc/Compony/ModelFields/Phone.html +301 -0
- data/doc/Compony/ModelFields/RichText.html +232 -0
- data/doc/Compony/ModelFields/String.html +154 -0
- data/doc/Compony/ModelFields/Text.html +154 -0
- data/doc/Compony/ModelFields/Time.html +154 -0
- data/doc/Compony/ModelFields/Url.html +240 -0
- data/doc/Compony/ModelFields.html +126 -0
- data/doc/Compony/ModelMixin.html +524 -0
- data/doc/Compony/RequestContext.html +791 -0
- data/doc/Compony/Version.html +139 -0
- data/doc/Compony/ViewHelpers.html +443 -0
- data/doc/Compony.html +2156 -0
- data/doc/ComponyController.html +124 -0
- data/doc/_index.html +569 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +1565 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/imgs/intro-example-destroy.png +0 -0
- data/doc/imgs/intro-example-edit.png +0 -0
- data/doc/imgs/intro-example-index.png +0 -0
- data/doc/imgs/intro-example-new.png +0 -0
- data/doc/imgs/intro-example-show.png +0 -0
- data/doc/index.html +1565 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1435 -0
- data/doc/resourceful_lifecycle.png +0 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/compony/component.rb +2 -1
- data/lib/compony/component_mixins/default/standalone/resourceful_verb_dsl.rb +1 -1
- data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +14 -3
- data/lib/compony/component_mixins/default/standalone/verb_dsl.rb +14 -5
- data/lib/compony/component_mixins/default/standalone.rb +10 -3
- data/lib/compony/components/form.rb +6 -1
- data/lib/compony/components/with_form.rb +14 -1
- data/lib/compony/model_fields/anchormodel.rb +0 -22
- data/lib/compony/model_mixin.rb +12 -2
- data/lib/compony/version.rb +1 -7
- data/logo.svg +133 -0
- metadata +83 -6
@@ -0,0 +1,524 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: Compony::ModelMixin
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Compony::ModelMixin";
|
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 (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">ModelMixin</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: Compony::ModelMixin
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
<dl>
|
73
|
+
<dt>Extended by:</dt>
|
74
|
+
<dd>ActiveSupport::Concern</dd>
|
75
|
+
</dl>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<dl>
|
85
|
+
<dt>Defined in:</dt>
|
86
|
+
<dd>lib/compony/model_mixin.rb</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
<div class="tags">
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<h2>
|
109
|
+
Instance Method Summary
|
110
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
111
|
+
</h2>
|
112
|
+
|
113
|
+
<ul class="summary">
|
114
|
+
|
115
|
+
<li class="public ">
|
116
|
+
<span class="summary_signature">
|
117
|
+
|
118
|
+
<a href="#feasibility_messages-instance_method" title="#feasibility_messages (instance method)">#<strong>feasibility_messages</strong>(action_name) ⇒ Object </a>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
</span>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<span class="summary_desc"><div class='inline'>
|
133
|
+
<p>Retrieves feasibility for the given instance and returns an array of reasons preventing the feasibility.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#feasible%3F-instance_method" title="#feasible? (instance method)">#<strong>feasible?</strong>(action_name, recompute: false) ⇒ Boolean </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'>
|
157
|
+
<p>Retrieves feasibility for the given instance, returning a boolean indicating whether the action is feasibly.</p>
|
158
|
+
</div></span>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
<li class="public ">
|
164
|
+
<span class="summary_signature">
|
165
|
+
|
166
|
+
<a href="#field-instance_method" title="#field (instance method)">#<strong>field</strong>(field_name, controller) ⇒ Object </a>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
</span>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'>
|
181
|
+
<p>Calls value_for on the desired field.</p>
|
182
|
+
</div></span>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
<li class="public ">
|
188
|
+
<span class="summary_signature">
|
189
|
+
|
190
|
+
<a href="#full_feasibility_messages-instance_method" title="#full_feasibility_messages (instance method)">#<strong>full_feasibility_messages</strong>(action_name) ⇒ Object </a>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
</span>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
<span class="summary_desc"><div class='inline'>
|
205
|
+
<p>Retrieves feasibility for the given instance and returns a string holding all reasons preventing the feasibility.</p>
|
206
|
+
</div></span>
|
207
|
+
|
208
|
+
</li>
|
209
|
+
|
210
|
+
|
211
|
+
</ul>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<div id="instance_method_details" class="method_details_list">
|
218
|
+
<h2>Instance Method Details</h2>
|
219
|
+
|
220
|
+
|
221
|
+
<div class="method_details first">
|
222
|
+
<h3 class="signature first" id="feasibility_messages-instance_method">
|
223
|
+
|
224
|
+
#<strong>feasibility_messages</strong>(action_name) ⇒ <tt>Object</tt>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</h3><div class="docstring">
|
231
|
+
<div class="discussion">
|
232
|
+
|
233
|
+
<p>Retrieves feasibility for the given instance and returns an array of reasons preventing the feasibility. Returns an empty array if feasible. Conceptually, this is comparable to a model’s <code>errors</code>.</p>
|
234
|
+
|
235
|
+
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
<div class="tags">
|
239
|
+
<p class="tag_title">Parameters:</p>
|
240
|
+
<ul class="param">
|
241
|
+
|
242
|
+
<li>
|
243
|
+
|
244
|
+
<span class='name'>action_name</span>
|
245
|
+
|
246
|
+
|
247
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
—
|
252
|
+
<div class='inline'>
|
253
|
+
<p>the action that the feasibility should be checked for, e.g. :destroy</p>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
</li>
|
257
|
+
|
258
|
+
</ul>
|
259
|
+
|
260
|
+
|
261
|
+
</div><table class="source_code">
|
262
|
+
<tr>
|
263
|
+
<td>
|
264
|
+
<pre class="lines">
|
265
|
+
|
266
|
+
|
267
|
+
92
|
268
|
+
93
|
269
|
+
94
|
270
|
+
95
|
271
|
+
96</pre>
|
272
|
+
</td>
|
273
|
+
<td>
|
274
|
+
<pre class="code"><span class="info file"># File 'lib/compony/model_mixin.rb', line 92</span>
|
275
|
+
|
276
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_feasibility_messages'>feasibility_messages</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span>
|
277
|
+
<span class='id identifier rubyid_action_name'>action_name</span> <span class='op'>=</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
278
|
+
<span class='id identifier rubyid_feasible?'>feasible?</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@feasibility_messages</span><span class='op'>&.</span><span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='comment'># If feasibility check hasn't been performed yet for this action, perform it now
|
279
|
+
</span> <span class='kw'>return</span> <span class='ivar'>@feasibility_messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rbracket'>]</span>
|
280
|
+
<span class='kw'>end</span></pre>
|
281
|
+
</td>
|
282
|
+
</tr>
|
283
|
+
</table>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div class="method_details ">
|
287
|
+
<h3 class="signature " id="feasible?-instance_method">
|
288
|
+
|
289
|
+
#<strong>feasible?</strong>(action_name, recompute: false) ⇒ <tt>Boolean</tt>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
</h3><div class="docstring">
|
296
|
+
<div class="discussion">
|
297
|
+
|
298
|
+
<p>Retrieves feasibility for the given instance, returning a boolean indicating whether the action is feasibly. Calling this with an invalid action name will always return true. This also generates appropriate error messages for any reason causing it to return false. Feasilbility is cached, thus the second access will be faster.</p>
|
299
|
+
|
300
|
+
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
<div class="tags">
|
304
|
+
<p class="tag_title">Parameters:</p>
|
305
|
+
<ul class="param">
|
306
|
+
|
307
|
+
<li>
|
308
|
+
|
309
|
+
<span class='name'>action_name</span>
|
310
|
+
|
311
|
+
|
312
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
—
|
317
|
+
<div class='inline'>
|
318
|
+
<p>the action that the feasibility should be checked for, e.g. :destroy</p>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
</li>
|
322
|
+
|
323
|
+
<li>
|
324
|
+
|
325
|
+
<span class='name'>recompute</span>
|
326
|
+
|
327
|
+
|
328
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
329
|
+
|
330
|
+
|
331
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
332
|
+
|
333
|
+
|
334
|
+
—
|
335
|
+
<div class='inline'>
|
336
|
+
<p>whether feasibility should be forcably recomputed even if a cached result is present</p>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
</li>
|
340
|
+
|
341
|
+
</ul>
|
342
|
+
|
343
|
+
<p class="tag_title">Returns:</p>
|
344
|
+
<ul class="return">
|
345
|
+
|
346
|
+
<li>
|
347
|
+
|
348
|
+
|
349
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
</li>
|
354
|
+
|
355
|
+
</ul>
|
356
|
+
|
357
|
+
</div><table class="source_code">
|
358
|
+
<tr>
|
359
|
+
<td>
|
360
|
+
<pre class="lines">
|
361
|
+
|
362
|
+
|
363
|
+
71
|
364
|
+
72
|
365
|
+
73
|
366
|
+
74
|
367
|
+
75
|
368
|
+
76
|
369
|
+
77
|
370
|
+
78
|
371
|
+
79
|
372
|
+
80
|
373
|
+
81
|
374
|
+
82
|
375
|
+
83
|
376
|
+
84
|
377
|
+
85
|
378
|
+
86
|
379
|
+
87</pre>
|
380
|
+
</td>
|
381
|
+
<td>
|
382
|
+
<pre class="code"><span class="info file"># File 'lib/compony/model_mixin.rb', line 71</span>
|
383
|
+
|
384
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_feasible?'>feasible?</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>recompute:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
385
|
+
<span class='id identifier rubyid_action_name'>action_name</span> <span class='op'>=</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
386
|
+
<span class='ivar'>@feasibility_messages</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
387
|
+
<span class='comment'># Abort if check has already run and recompute is false
|
388
|
+
</span> <span class='kw'>if</span> <span class='ivar'>@feasibility_messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_recompute'>recompute</span>
|
389
|
+
<span class='comment'># Lazily autodetect feasibilities
|
390
|
+
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_autodetect_feasibilities!'>autodetect_feasibilities!</span>
|
391
|
+
<span class='comment'># Compute feasibility and gather messages
|
392
|
+
</span> <span class='ivar'>@feasibility_messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
393
|
+
<span class='id identifier rubyid_feasibility_preventions'>feasibility_preventions</span><span class='lbracket'>[</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_prevention'>prevention</span><span class='op'>|</span>
|
394
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_instance_exec'>instance_exec</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_prevention'>prevention</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
395
|
+
<span class='ivar'>@feasibility_messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_prevention'>prevention</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
396
|
+
<span class='kw'>end</span>
|
397
|
+
<span class='kw'>end</span>
|
398
|
+
<span class='kw'>end</span>
|
399
|
+
<span class='kw'>return</span> <span class='ivar'>@feasibility_messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_none?'>none?</span>
|
400
|
+
<span class='kw'>end</span></pre>
|
401
|
+
</td>
|
402
|
+
</tr>
|
403
|
+
</table>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
<div class="method_details ">
|
407
|
+
<h3 class="signature " id="field-instance_method">
|
408
|
+
|
409
|
+
#<strong>field</strong>(field_name, controller) ⇒ <tt>Object</tt>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
</h3><div class="docstring">
|
416
|
+
<div class="discussion">
|
417
|
+
|
418
|
+
<p>Calls value_for on the desired field. Do not confuse with the static method field.</p>
|
419
|
+
|
420
|
+
|
421
|
+
</div>
|
422
|
+
</div>
|
423
|
+
<div class="tags">
|
424
|
+
|
425
|
+
|
426
|
+
</div><table class="source_code">
|
427
|
+
<tr>
|
428
|
+
<td>
|
429
|
+
<pre class="lines">
|
430
|
+
|
431
|
+
|
432
|
+
109
|
433
|
+
110
|
434
|
+
111</pre>
|
435
|
+
</td>
|
436
|
+
<td>
|
437
|
+
<pre class="code"><span class="info file"># File 'lib/compony/model_mixin.rb', line 109</span>
|
438
|
+
|
439
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='id identifier rubyid_field_name'>field_name</span><span class='comma'>,</span> <span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
|
440
|
+
<span class='id identifier rubyid_fields'>fields</span><span class='lbracket'>[</span><span class='id identifier rubyid_field_name'>field_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value_for'>value_for</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='label'>controller:</span><span class='rparen'>)</span>
|
441
|
+
<span class='kw'>end</span></pre>
|
442
|
+
</td>
|
443
|
+
</tr>
|
444
|
+
</table>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
<div class="method_details ">
|
448
|
+
<h3 class="signature " id="full_feasibility_messages-instance_method">
|
449
|
+
|
450
|
+
#<strong>full_feasibility_messages</strong>(action_name) ⇒ <tt>Object</tt>
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
</h3><div class="docstring">
|
457
|
+
<div class="discussion">
|
458
|
+
|
459
|
+
<p>Retrieves feasibility for the given instance and returns a string holding all reasons preventing the feasibility. Returns an empty string if feasible. Messages are joined using commata. The first character is capitalized and a period is added to the end. Conceptually, this is comparable to a model’s <code>full_messages</code>.</p>
|
460
|
+
|
461
|
+
|
462
|
+
</div>
|
463
|
+
</div>
|
464
|
+
<div class="tags">
|
465
|
+
<p class="tag_title">Parameters:</p>
|
466
|
+
<ul class="param">
|
467
|
+
|
468
|
+
<li>
|
469
|
+
|
470
|
+
<span class='name'>action_name</span>
|
471
|
+
|
472
|
+
|
473
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
—
|
478
|
+
<div class='inline'>
|
479
|
+
<p>the action that the feasibility should be checked for, e.g. :destroy</p>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
</li>
|
483
|
+
|
484
|
+
</ul>
|
485
|
+
|
486
|
+
|
487
|
+
</div><table class="source_code">
|
488
|
+
<tr>
|
489
|
+
<td>
|
490
|
+
<pre class="lines">
|
491
|
+
|
492
|
+
|
493
|
+
102
|
494
|
+
103
|
495
|
+
104
|
496
|
+
105
|
497
|
+
106</pre>
|
498
|
+
</td>
|
499
|
+
<td>
|
500
|
+
<pre class="code"><span class="info file"># File 'lib/compony/model_mixin.rb', line 102</span>
|
501
|
+
|
502
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_full_feasibility_messages'>full_feasibility_messages</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span>
|
503
|
+
<span class='id identifier rubyid_text'>text</span> <span class='op'>=</span> <span class='id identifier rubyid_feasibility_messages'>feasibility_messages</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>, </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_upcase_first'>upcase_first</span>
|
504
|
+
<span class='id identifier rubyid_text'>text</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
505
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_text'>text</span>
|
506
|
+
<span class='kw'>end</span></pre>
|
507
|
+
</td>
|
508
|
+
</tr>
|
509
|
+
</table>
|
510
|
+
</div>
|
511
|
+
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
<div id="footer">
|
517
|
+
Generated on Wed Apr 24 17:14:06 2024 by
|
518
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
519
|
+
0.9.34 (ruby-3.2.2).
|
520
|
+
</div>
|
521
|
+
|
522
|
+
</div>
|
523
|
+
</body>
|
524
|
+
</html>
|