hyperactiveform 0.4.0 → 0.5.0
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 +7 -0
- data/README.md +9 -0
- data/context7.json +4 -0
- data/docs/FormGenerator.html +11 -7
- data/docs/HyperActiveForm/Base.html +215 -115
- data/docs/HyperActiveForm/CancelFormSubmit.html +10 -7
- data/docs/HyperActiveForm/FormDidNotSubmitError.html +10 -7
- data/docs/HyperActiveForm/Generators/InstallGenerator.html +11 -7
- data/docs/HyperActiveForm/Generators.html +10 -7
- data/docs/HyperActiveForm.html +12 -9
- data/docs/Hyperactiveform_.html +146 -0
- data/docs/Rspec/Generators/FormGenerator.html +11 -7
- data/docs/Rspec/Generators.html +10 -7
- data/docs/Rspec.html +10 -7
- data/docs/TestUnit/Generators/FormGenerator.html +11 -7
- data/docs/TestUnit/Generators.html +10 -7
- data/docs/TestUnit.html +10 -7
- data/docs/_index.html +20 -13
- data/docs/class_list.html +6 -6
- data/docs/css/common.css +1 -1
- data/docs/css/full_list.css +201 -53
- data/docs/css/style.css +988 -402
- data/docs/file.README.html +29 -78
- data/docs/file_list.html +5 -5
- data/docs/frames.html +1 -1
- data/docs/index.html +29 -78
- data/docs/js/app.js +800 -343
- data/docs/js/full_list.js +332 -240
- data/docs/method_list.html +5 -5
- data/docs/top-level-namespace.html +9 -7
- data/gemfiles/{Gemfile.rails-8.x → Gemfile.rails-8.0.x} +1 -1
- data/gemfiles/Gemfile.rails-8.1.x +5 -0
- data/lib/hyper_active_form/base.rb +22 -6
- data/lib/hyper_active_form/version.rb +1 -1
- metadata +7 -7
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: HyperActiveForm::Base
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.9.
|
|
9
|
+
— Documentation by YARD 0.9.45
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css">
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css">
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript">
|
|
18
18
|
pathId = "HyperActiveForm::Base";
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
</head>
|
|
29
29
|
<body>
|
|
30
|
+
<div id="main_progress" aria-hidden="true"></div>
|
|
31
|
+
|
|
30
32
|
<div class="nav_wrap">
|
|
31
33
|
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
32
34
|
<div id="resizer"></div>
|
|
@@ -104,18 +106,18 @@
|
|
|
104
106
|
|
|
105
107
|
<dl>
|
|
106
108
|
<dt>Defined in:</dt>
|
|
107
|
-
<dd>lib/hyper_active_form/base.rb
|
|
109
|
+
<dd>lib/hyper_active_form/base.rb
|
|
110
|
+
</dd>
|
|
108
111
|
</dl>
|
|
109
112
|
|
|
110
113
|
</div>
|
|
111
114
|
|
|
112
115
|
<h2>Overview</h2><div class="docstring">
|
|
113
116
|
<div class="discussion">
|
|
114
|
-
|
|
115
|
-
<p>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
<p>Base class for HyperActiveForm objects</p>
|
|
118
|
+
<p>HyperActiveForm objects are simple ActiveModel objects that encapsulate
|
|
119
|
+
form logic and validations. They are designed to be subclassed and
|
|
120
|
+
customized to fit the needs of your application.</p>
|
|
119
121
|
|
|
120
122
|
</div>
|
|
121
123
|
</div>
|
|
@@ -151,9 +153,7 @@
|
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
|
|
154
|
-
<span class="summary_desc"><div class='inline'>
|
|
155
|
-
<p>The list of attribute names that have been passed to the form during the last call to ‘assign_form_attributes` or `submit`.</p>
|
|
156
|
-
</div></span>
|
|
156
|
+
<span class="summary_desc"><div class='inline'><p>The list of attribute names that have been passed to the form during the last call to <code>assign_form_attributes</code> or <code>submit</code>.</p></div></span>
|
|
157
157
|
|
|
158
158
|
</li>
|
|
159
159
|
|
|
@@ -188,14 +188,13 @@
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
|
|
191
|
-
<span class="summary_desc"><div class='inline'>
|
|
192
|
-
<p>Defines to which object the form should delegate the active model methods This is useful so ‘form_for`/`form_with` can automatically deduce the url and method to use.</p>
|
|
193
|
-
</div></span>
|
|
191
|
+
<span class="summary_desc"><div class='inline'><p>Defines to which object the form should delegate the active model methods This is useful so <code>form_for</code>/<code>form_with</code> can automatically deduce the url and method to use.</p></div></span>
|
|
194
192
|
|
|
195
193
|
</li>
|
|
196
194
|
|
|
197
195
|
|
|
198
196
|
</ul>
|
|
197
|
+
|
|
199
198
|
|
|
200
199
|
<h2>
|
|
201
200
|
Instance Method Summary
|
|
@@ -221,9 +220,7 @@
|
|
|
221
220
|
|
|
222
221
|
|
|
223
222
|
|
|
224
|
-
<span class="summary_desc"><div class='inline'>
|
|
225
|
-
<p>Adds the errors from a model to the form.</p>
|
|
226
|
-
</div></span>
|
|
223
|
+
<span class="summary_desc"><div class='inline'><p>Adds the errors from a model to the form.</p></div></span>
|
|
227
224
|
|
|
228
225
|
</li>
|
|
229
226
|
|
|
@@ -231,7 +228,7 @@
|
|
|
231
228
|
<li class="public ">
|
|
232
229
|
<span class="summary_signature">
|
|
233
230
|
|
|
234
|
-
<a href="#assign_form_attributes-instance_method" title="#assign_form_attributes (instance method)">#<strong>assign_form_attributes</strong>(params) ⇒ Object </a>
|
|
231
|
+
<a href="#assign_form_attributes-instance_method" title="#assign_form_attributes (instance method)">#<strong>assign_form_attributes</strong>(params = nil, **options) ⇒ Object </a>
|
|
235
232
|
|
|
236
233
|
|
|
237
234
|
|
|
@@ -245,9 +242,7 @@
|
|
|
245
242
|
|
|
246
243
|
|
|
247
244
|
|
|
248
|
-
<span class="summary_desc"><div class='inline'>
|
|
249
|
-
<p>Assigns the attributes of the form from the params This method is called by the ‘submit` method, but can also be called directly if you need to assign the attributes without submitting the form for example if you want to refresh the form with new data.</p>
|
|
250
|
-
</div></span>
|
|
245
|
+
<span class="summary_desc"><div class='inline'><p>Assigns the attributes of the form from the params This method is called by the <code>submit</code> method, but can also be called directly if you need to assign the attributes without submitting the form for example if you want to refresh the form with new data.</p></div></span>
|
|
251
246
|
|
|
252
247
|
</li>
|
|
253
248
|
|
|
@@ -271,9 +266,7 @@
|
|
|
271
266
|
|
|
272
267
|
|
|
273
268
|
|
|
274
|
-
<span class="summary_desc"><div class='inline'>
|
|
275
|
-
<p>A new instance of Base.</p>
|
|
276
|
-
</div></span>
|
|
269
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Base.</p></div></span>
|
|
277
270
|
|
|
278
271
|
</li>
|
|
279
272
|
|
|
@@ -325,7 +318,7 @@
|
|
|
325
318
|
<li class="public ">
|
|
326
319
|
<span class="summary_signature">
|
|
327
320
|
|
|
328
|
-
<a href="#submit-instance_method" title="#submit (instance method)">#<strong>submit</strong>(params) ⇒ Boolean </a>
|
|
321
|
+
<a href="#submit-instance_method" title="#submit (instance method)">#<strong>submit</strong>(params = nil, **options) ⇒ Boolean </a>
|
|
329
322
|
|
|
330
323
|
|
|
331
324
|
|
|
@@ -339,9 +332,7 @@
|
|
|
339
332
|
|
|
340
333
|
|
|
341
334
|
|
|
342
|
-
<span class="summary_desc"><div class='inline'>
|
|
343
|
-
<p>Submits the form, assigning the attributes from the params, running validations and calling the ‘perform` method if the form is valid.</p>
|
|
344
|
-
</div></span>
|
|
335
|
+
<span class="summary_desc"><div class='inline'><p>Submits the form, assigning the attributes from the params, running validations and calling the <code>perform</code> method if the form is valid.</p></div></span>
|
|
345
336
|
|
|
346
337
|
</li>
|
|
347
338
|
|
|
@@ -349,7 +340,7 @@
|
|
|
349
340
|
<li class="public ">
|
|
350
341
|
<span class="summary_signature">
|
|
351
342
|
|
|
352
|
-
<a href="#submit!-instance_method" title="#submit! (instance method)">#<strong>submit!</strong>(params) ⇒ Boolean </a>
|
|
343
|
+
<a href="#submit!-instance_method" title="#submit! (instance method)">#<strong>submit!</strong>(params = nil, **options) ⇒ Boolean </a>
|
|
353
344
|
|
|
354
345
|
|
|
355
346
|
|
|
@@ -363,14 +354,13 @@
|
|
|
363
354
|
|
|
364
355
|
|
|
365
356
|
|
|
366
|
-
<span class="summary_desc"><div class='inline'>
|
|
367
|
-
<p>Same as ‘submit` but raises a `FormDidNotSubmitError` if the form is not valid.</p>
|
|
368
|
-
</div></span>
|
|
357
|
+
<span class="summary_desc"><div class='inline'><p>Same as <code>submit</code> but raises a <code>FormDidNotSubmitError</code> if the form is not valid.</p></div></span>
|
|
369
358
|
|
|
370
359
|
</li>
|
|
371
360
|
|
|
372
361
|
|
|
373
362
|
</ul>
|
|
363
|
+
|
|
374
364
|
|
|
375
365
|
|
|
376
366
|
|
|
@@ -391,9 +381,7 @@
|
|
|
391
381
|
|
|
392
382
|
</h3><div class="docstring">
|
|
393
383
|
<div class="discussion">
|
|
394
|
-
|
|
395
|
-
<p>Returns a new instance of Base.</p>
|
|
396
|
-
|
|
384
|
+
<p>Returns a new instance of Base.</p>
|
|
397
385
|
|
|
398
386
|
</div>
|
|
399
387
|
</div>
|
|
@@ -441,9 +429,8 @@
|
|
|
441
429
|
|
|
442
430
|
</h3><div class="docstring">
|
|
443
431
|
<div class="discussion">
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
432
|
+
<p>The list of attribute names that have been passed to the form
|
|
433
|
+
during the last call to <code>assign_form_attributes</code> or <code>submit</code></p>
|
|
447
434
|
|
|
448
435
|
</div>
|
|
449
436
|
</div>
|
|
@@ -489,9 +476,8 @@
|
|
|
489
476
|
|
|
490
477
|
</h3><div class="docstring">
|
|
491
478
|
<div class="discussion">
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
479
|
+
<p>Defines to which object the form should delegate the active model methods
|
|
480
|
+
This is useful so <code>form_for</code>/<code>form_with</code> can automatically deduce the url and method to use</p>
|
|
495
481
|
|
|
496
482
|
</div>
|
|
497
483
|
</div>
|
|
@@ -509,9 +495,7 @@
|
|
|
509
495
|
|
|
510
496
|
|
|
511
497
|
—
|
|
512
|
-
<div class='inline'>
|
|
513
|
-
<p>the class of the object to proxy</p>
|
|
514
|
-
</div>
|
|
498
|
+
<div class='inline'><p>the class of the object to proxy</p></div>
|
|
515
499
|
|
|
516
500
|
</li>
|
|
517
501
|
|
|
@@ -525,9 +509,7 @@
|
|
|
525
509
|
|
|
526
510
|
|
|
527
511
|
—
|
|
528
|
-
<div class='inline'>
|
|
529
|
-
<p>where to delegate the object to, for example: ‘:@user`</p>
|
|
530
|
-
</div>
|
|
512
|
+
<div class='inline'><p>where to delegate the object to, for example: <code>:@user</code></p></div>
|
|
531
513
|
|
|
532
514
|
</li>
|
|
533
515
|
|
|
@@ -574,9 +556,7 @@
|
|
|
574
556
|
|
|
575
557
|
</h3><div class="docstring">
|
|
576
558
|
<div class="discussion">
|
|
577
|
-
|
|
578
|
-
<p>Adds the errors from a model to the form</p>
|
|
579
|
-
|
|
559
|
+
<p>Adds the errors from a model to the form</p>
|
|
580
560
|
|
|
581
561
|
</div>
|
|
582
562
|
</div>
|
|
@@ -594,9 +574,7 @@
|
|
|
594
574
|
|
|
595
575
|
|
|
596
576
|
—
|
|
597
|
-
<div class='inline'>
|
|
598
|
-
<p>the model to add the errors from</p>
|
|
599
|
-
</div>
|
|
577
|
+
<div class='inline'><p>the model to add the errors from</p></div>
|
|
600
578
|
|
|
601
579
|
</li>
|
|
602
580
|
|
|
@@ -609,16 +587,16 @@
|
|
|
609
587
|
<pre class="lines">
|
|
610
588
|
|
|
611
589
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
590
|
+
105
|
|
591
|
+
106
|
|
592
|
+
107
|
|
593
|
+
108
|
|
594
|
+
109
|
|
595
|
+
110
|
|
596
|
+
111</pre>
|
|
619
597
|
</td>
|
|
620
598
|
<td>
|
|
621
|
-
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line
|
|
599
|
+
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line 105</span>
|
|
622
600
|
|
|
623
601
|
<span class='kw'>def</span> <span class='id identifier rubyid_add_errors_from'>add_errors_from</span><span class='lparen'>(</span><span class='id identifier rubyid_model'>model</span><span class='rparen'>)</span>
|
|
624
602
|
<span class='id identifier rubyid_model'>model</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_error'>error</span><span class='op'>|</span>
|
|
@@ -635,7 +613,7 @@
|
|
|
635
613
|
<div class="method_details ">
|
|
636
614
|
<h3 class="signature " id="assign_form_attributes-instance_method">
|
|
637
615
|
|
|
638
|
-
#<strong>assign_form_attributes</strong>(params) ⇒ <tt>Object</tt>
|
|
616
|
+
#<strong>assign_form_attributes</strong>(params = nil, **options) ⇒ <tt>Object</tt>
|
|
639
617
|
|
|
640
618
|
|
|
641
619
|
|
|
@@ -643,9 +621,10 @@
|
|
|
643
621
|
|
|
644
622
|
</h3><div class="docstring">
|
|
645
623
|
<div class="discussion">
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
624
|
+
<p>Assigns the attributes of the form from the params
|
|
625
|
+
This method is called by the <code>submit</code> method, but can also be called
|
|
626
|
+
directly if you need to assign the attributes without submitting the form
|
|
627
|
+
for example if you want to refresh the form with new data</p>
|
|
649
628
|
|
|
650
629
|
</div>
|
|
651
630
|
</div>
|
|
@@ -661,16 +640,52 @@
|
|
|
661
640
|
<span class='type'>(<tt>Hash</tt>)</span>
|
|
662
641
|
|
|
663
642
|
|
|
643
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
644
|
+
|
|
664
645
|
|
|
665
646
|
—
|
|
666
|
-
<div class='inline'>
|
|
667
|
-
|
|
668
|
-
</
|
|
647
|
+
<div class='inline'><p>the params to assign the attributes from</p></div>
|
|
648
|
+
|
|
649
|
+
</li>
|
|
650
|
+
|
|
651
|
+
<li>
|
|
652
|
+
|
|
653
|
+
<span class='name'>options</span>
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
—
|
|
661
|
+
<div class='inline'><p>optional keyword arguments</p></div>
|
|
669
662
|
|
|
670
663
|
</li>
|
|
671
664
|
|
|
672
665
|
</ul>
|
|
673
666
|
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
<p class="tag_title">Options Hash (<tt>**options</tt>):</p>
|
|
673
|
+
<ul class="option">
|
|
674
|
+
|
|
675
|
+
<li>
|
|
676
|
+
<span class="name">:overwrite_missing</span>
|
|
677
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
|
678
|
+
<span class="default">
|
|
679
|
+
|
|
680
|
+
</span>
|
|
681
|
+
|
|
682
|
+
— <div class='inline'><p>whether to overwrite missing attributes with their default value or nil</p></div>
|
|
683
|
+
|
|
684
|
+
</li>
|
|
685
|
+
|
|
686
|
+
</ul>
|
|
687
|
+
|
|
688
|
+
|
|
674
689
|
|
|
675
690
|
</div><table class="source_code">
|
|
676
691
|
<tr>
|
|
@@ -678,8 +693,6 @@
|
|
|
678
693
|
<pre class="lines">
|
|
679
694
|
|
|
680
695
|
|
|
681
|
-
53
|
|
682
|
-
54
|
|
683
696
|
55
|
|
684
697
|
56
|
|
685
698
|
57
|
|
@@ -687,17 +700,39 @@
|
|
|
687
700
|
59
|
|
688
701
|
60
|
|
689
702
|
61
|
|
690
|
-
62
|
|
703
|
+
62
|
|
704
|
+
63
|
|
705
|
+
64
|
|
706
|
+
65
|
|
707
|
+
66
|
|
708
|
+
67
|
|
709
|
+
68
|
|
710
|
+
69
|
|
711
|
+
70
|
|
712
|
+
71
|
|
713
|
+
72
|
|
714
|
+
73
|
|
715
|
+
74</pre>
|
|
691
716
|
</td>
|
|
692
717
|
<td>
|
|
693
|
-
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line
|
|
718
|
+
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line 55</span>
|
|
719
|
+
|
|
720
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_assign_form_attributes'>assign_form_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
721
|
+
<span class='id identifier rubyid_overwrite_missing'>overwrite_missing</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
722
|
+
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
|
|
723
|
+
<span class='kw'>else</span>
|
|
724
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:overwrite_missing</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
|
725
|
+
<span class='kw'>end</span>
|
|
694
726
|
|
|
695
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_assign_form_attributes'>assign_form_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
|
696
727
|
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span> <span class='symbol'>:assign_form_attributes</span> <span class='kw'>do</span>
|
|
697
728
|
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='const'>ActionController</span><span class='op'>::</span><span class='const'>Parameters</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>ActionController</span><span class='op'>::</span><span class='const'>Parameters</span><span class='rparen'>)</span>
|
|
698
729
|
<span class='id identifier rubyid_attribute_names'>attribute_names</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attribute'>attribute</span><span class='op'>|</span>
|
|
699
730
|
<span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</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__default_attributes'>_default_attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_value_before_type_cast'>value_before_type_cast</span>
|
|
700
|
-
<span class='
|
|
731
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='op'>&.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span>
|
|
732
|
+
<span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='symbol'>:"#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='op'>&.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
733
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_overwrite_missing'>overwrite_missing</span>
|
|
734
|
+
<span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='symbol'>:"#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='rparen'>)</span>
|
|
735
|
+
<span class='kw'>end</span>
|
|
701
736
|
<span class='kw'>end</span>
|
|
702
737
|
<span class='ivar'>@assigned_attribute_names</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_attribute_names'>attribute_names</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
|
703
738
|
<span class='kw'>end</span>
|
|
@@ -788,7 +823,7 @@
|
|
|
788
823
|
<div class="method_details ">
|
|
789
824
|
<h3 class="signature " id="submit-instance_method">
|
|
790
825
|
|
|
791
|
-
#<strong>submit</strong>(params) ⇒ <tt>Boolean</tt>
|
|
826
|
+
#<strong>submit</strong>(params = nil, **options) ⇒ <tt>Boolean</tt>
|
|
792
827
|
|
|
793
828
|
|
|
794
829
|
|
|
@@ -796,9 +831,8 @@
|
|
|
796
831
|
|
|
797
832
|
</h3><div class="docstring">
|
|
798
833
|
<div class="discussion">
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
834
|
+
<p>Submits the form, assigning the attributes from the params,
|
|
835
|
+
running validations and calling the <code>perform</code> method if the form is valid</p>
|
|
802
836
|
|
|
803
837
|
</div>
|
|
804
838
|
</div>
|
|
@@ -814,16 +848,52 @@
|
|
|
814
848
|
<span class='type'>(<tt>Hash</tt>)</span>
|
|
815
849
|
|
|
816
850
|
|
|
851
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
852
|
+
|
|
817
853
|
|
|
818
854
|
—
|
|
819
|
-
<div class='inline'>
|
|
820
|
-
|
|
821
|
-
</
|
|
855
|
+
<div class='inline'><p>the params to assign the attributes from</p></div>
|
|
856
|
+
|
|
857
|
+
</li>
|
|
858
|
+
|
|
859
|
+
<li>
|
|
860
|
+
|
|
861
|
+
<span class='name'>options</span>
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
—
|
|
869
|
+
<div class='inline'><p>optional keyword arguments</p></div>
|
|
822
870
|
|
|
823
871
|
</li>
|
|
824
872
|
|
|
825
873
|
</ul>
|
|
826
874
|
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
<p class="tag_title">Options Hash (<tt>**options</tt>):</p>
|
|
881
|
+
<ul class="option">
|
|
882
|
+
|
|
883
|
+
<li>
|
|
884
|
+
<span class="name">:overwrite_missing</span>
|
|
885
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
|
886
|
+
<span class="default">
|
|
887
|
+
|
|
888
|
+
</span>
|
|
889
|
+
|
|
890
|
+
— <div class='inline'><p>whether to overwrite missing attributes with their default value or nil</p></div>
|
|
891
|
+
|
|
892
|
+
</li>
|
|
893
|
+
|
|
894
|
+
</ul>
|
|
895
|
+
|
|
896
|
+
|
|
827
897
|
<p class="tag_title">Returns:</p>
|
|
828
898
|
<ul class="return">
|
|
829
899
|
|
|
@@ -835,9 +905,7 @@
|
|
|
835
905
|
|
|
836
906
|
|
|
837
907
|
—
|
|
838
|
-
<div class='inline'>
|
|
839
|
-
<p>true if the form is valid and the ‘perform` method returned something truthy</p>
|
|
840
|
-
</div>
|
|
908
|
+
<div class='inline'><p>true if the form is valid and the <code>perform</code> method returned something truthy</p></div>
|
|
841
909
|
|
|
842
910
|
</li>
|
|
843
911
|
|
|
@@ -849,21 +917,21 @@
|
|
|
849
917
|
<pre class="lines">
|
|
850
918
|
|
|
851
919
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
920
|
+
83
|
|
921
|
+
84
|
|
922
|
+
85
|
|
923
|
+
86
|
|
924
|
+
87
|
|
925
|
+
88
|
|
926
|
+
89
|
|
927
|
+
90</pre>
|
|
860
928
|
</td>
|
|
861
929
|
<td>
|
|
862
|
-
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line
|
|
930
|
+
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line 83</span>
|
|
863
931
|
|
|
864
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
|
932
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
865
933
|
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span> <span class='symbol'>:submit</span> <span class='kw'>do</span>
|
|
866
|
-
<span class='id identifier rubyid_assign_form_attributes'>assign_form_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
|
934
|
+
<span class='id identifier rubyid_assign_form_attributes'>assign_form_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
867
935
|
<span class='op'>!</span><span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_valid?'>valid?</span> <span class='op'>&&</span> <span class='id identifier rubyid_perform'>perform</span><span class='rparen'>)</span>
|
|
868
936
|
<span class='kw'>end</span>
|
|
869
937
|
<span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="../HyperActiveForm.html" title="HyperActiveForm (module)">HyperActiveForm</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CancelFormSubmit.html" title="HyperActiveForm::CancelFormSubmit (class)">CancelFormSubmit</a></span></span>
|
|
@@ -877,7 +945,7 @@
|
|
|
877
945
|
<div class="method_details ">
|
|
878
946
|
<h3 class="signature " id="submit!-instance_method">
|
|
879
947
|
|
|
880
|
-
#<strong>submit!</strong>(params) ⇒ <tt>Boolean</tt>
|
|
948
|
+
#<strong>submit!</strong>(params = nil, **options) ⇒ <tt>Boolean</tt>
|
|
881
949
|
|
|
882
950
|
|
|
883
951
|
|
|
@@ -885,9 +953,7 @@
|
|
|
885
953
|
|
|
886
954
|
</h3><div class="docstring">
|
|
887
955
|
<div class="discussion">
|
|
888
|
-
|
|
889
|
-
<p>Same as ‘submit` but raises a `FormDidNotSubmitError` if the form is not valid</p>
|
|
890
|
-
|
|
956
|
+
<p>Same as <code>submit</code> but raises a <code>FormDidNotSubmitError</code> if the form is not valid</p>
|
|
891
957
|
|
|
892
958
|
</div>
|
|
893
959
|
</div>
|
|
@@ -903,16 +969,52 @@
|
|
|
903
969
|
<span class='type'>(<tt>Hash</tt>)</span>
|
|
904
970
|
|
|
905
971
|
|
|
972
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
973
|
+
|
|
906
974
|
|
|
907
975
|
—
|
|
908
|
-
<div class='inline'>
|
|
909
|
-
|
|
910
|
-
</
|
|
976
|
+
<div class='inline'><p>the params to assign the attributes from</p></div>
|
|
977
|
+
|
|
978
|
+
</li>
|
|
979
|
+
|
|
980
|
+
<li>
|
|
981
|
+
|
|
982
|
+
<span class='name'>options</span>
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
—
|
|
990
|
+
<div class='inline'><p>optional keyword arguments</p></div>
|
|
911
991
|
|
|
912
992
|
</li>
|
|
913
993
|
|
|
914
994
|
</ul>
|
|
915
995
|
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
<p class="tag_title">Options Hash (<tt>**options</tt>):</p>
|
|
1002
|
+
<ul class="option">
|
|
1003
|
+
|
|
1004
|
+
<li>
|
|
1005
|
+
<span class="name">:overwrite_missing</span>
|
|
1006
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
|
1007
|
+
<span class="default">
|
|
1008
|
+
|
|
1009
|
+
</span>
|
|
1010
|
+
|
|
1011
|
+
— <div class='inline'><p>whether to overwrite missing attributes with their default value or nil</p></div>
|
|
1012
|
+
|
|
1013
|
+
</li>
|
|
1014
|
+
|
|
1015
|
+
</ul>
|
|
1016
|
+
|
|
1017
|
+
|
|
916
1018
|
<p class="tag_title">Returns:</p>
|
|
917
1019
|
<ul class="return">
|
|
918
1020
|
|
|
@@ -924,9 +1026,7 @@
|
|
|
924
1026
|
|
|
925
1027
|
|
|
926
1028
|
—
|
|
927
|
-
<div class='inline'>
|
|
928
|
-
<p>true if the form is valid and the ‘perform` method returned something truthy</p>
|
|
929
|
-
</div>
|
|
1029
|
+
<div class='inline'><p>true if the form is valid and the <code>perform</code> method returned something truthy</p></div>
|
|
930
1030
|
|
|
931
1031
|
</li>
|
|
932
1032
|
|
|
@@ -938,15 +1038,15 @@
|
|
|
938
1038
|
<pre class="lines">
|
|
939
1039
|
|
|
940
1040
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1041
|
+
98
|
|
1042
|
+
99
|
|
1043
|
+
100</pre>
|
|
944
1044
|
</td>
|
|
945
1045
|
<td>
|
|
946
|
-
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line
|
|
1046
|
+
<pre class="code"><span class="info file"># File 'lib/hyper_active_form/base.rb', line 98</span>
|
|
947
1047
|
|
|
948
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_submit!'>submit!</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
|
949
|
-
<span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../HyperActiveForm.html" title="HyperActiveForm (module)">HyperActiveForm</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FormDidNotSubmitError.html" title="HyperActiveForm::FormDidNotSubmitError (class)">FormDidNotSubmitError</a></span></span><span class='rparen'>)</span>
|
|
1048
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_submit!'>submit!</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
1049
|
+
<span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../HyperActiveForm.html" title="HyperActiveForm (module)">HyperActiveForm</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FormDidNotSubmitError.html" title="HyperActiveForm::FormDidNotSubmitError (class)">FormDidNotSubmitError</a></span></span><span class='rparen'>)</span>
|
|
950
1050
|
<span class='kw'>end</span></pre>
|
|
951
1051
|
</td>
|
|
952
1052
|
</tr>
|
|
@@ -958,11 +1058,11 @@
|
|
|
958
1058
|
</div>
|
|
959
1059
|
|
|
960
1060
|
<div id="footer">
|
|
961
|
-
Generated on
|
|
1061
|
+
Generated on Tue Aug 25 18:22:24 2026 by
|
|
962
1062
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
963
|
-
0.9.
|
|
1063
|
+
0.9.45 (ruby-4.0.6).
|
|
964
1064
|
</div>
|
|
965
1065
|
|
|
966
1066
|
</div>
|
|
967
1067
|
</body>
|
|
968
|
-
</html>
|
|
1068
|
+
</html>
|