hyperactiveform 0.4.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09dd7c7b6ba5fb3243de557d5a334e20139c69bb8e2d5ab3986eafb63a8e5f83'
4
- data.tar.gz: eef1dbc8453404b09a9801b9d6d4d21d54ab49bed96c50aabf8ee51afbb38c63
3
+ metadata.gz: e80d005bd550a0977af745a9f13660cb17bf32b87ddb7e496df3452741b689c4
4
+ data.tar.gz: 066a4d825873a0786ce3c6f6a8317a2e7426522774e93bc53494922eb5e58105
5
5
  SHA512:
6
- metadata.gz: bd2a315077081fa9ae68cbf1938c1167e38a83db60168666c048f1cf5cf7b4e477062ec203375a0692a208480d86bd31e3652d70b7a8118c4a9b10026b218ba7
7
- data.tar.gz: f9872fc6a83440e314a776c3ee604c3fb6a36666ebe5159342d81b7a2aa3ec4638f292ec5a2bcbd6fd3ccfa768bcd784bbdeeedbe8b18e6a4449ac81b376c816
6
+ metadata.gz: 026d4b6c200c4f82011da1f48621538702ab3d7b7bb33fd5d8136d9654bc5abcfaa62264d6c6b31e20097112c0d6898ea4639bccf380a250dc7dc0e3e4630704
7
+ data.tar.gz: 9cfb34b94c1324cec8f94176f2572d95f66cb3609478dcbf003148f0e563839b4f68b7a3b91b0e17279db17b783783f85f0ff554053b4d01b9379c1d2f956df0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2026-08-25
4
+ - Add the `overwrite_missing: false` option to `submit`, `submit!`, and `assign_form_attributes` to preserve current values for missing attributes instead of overwriting them with their default value or nil.
5
+
3
6
  ## [0.4.1] - 2025-05-12
4
7
  - Fixes a bug where if params contained expected falsey values, the form would treat them as nil.
5
8
  for instance `form.submit({likes_cat: false})` would set `likes_cat` to nil instead of false.
data/README.md CHANGED
@@ -147,6 +147,15 @@ The `perform` method is where you should do the actual form logic, like updating
147
147
 
148
148
  If the return value of `perform` is not truthy, `HyperActiveForm` will consider the form encountered an error and `submit` will return `false`, or `submit!` will raise a `HyperActiveForm::FormDidNotSubmitError`.
149
149
 
150
+ By default, `submit` and `assign_form_attributes` overwrite attributes that are missing from the params with their default value or `nil`. Pass `overwrite_missing: false` with an explicit params hash to preserve their current values:
151
+
152
+ ```ruby
153
+ @form.submit({ first_name: "John" }, overwrite_missing: false)
154
+ @form.assign_form_attributes({ first_name: "John" }, overwrite_missing: false)
155
+ ```
156
+
157
+ Explicitly provided values, including `nil`, are still assigned. `submit!` accepts the same option.
158
+
150
159
  At any point during the form processing, you can raise `HyperActiveForm::CancelForm` to cancel the form submission, this is the same as returning `false`.
151
160
 
152
161
  ## Understanding add_errors_from
data/context7.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "url": "https://context7.com/intrepidd/hyperactiveform",
3
+ "public_key": "pk_kz8GfCbrSNjZQqx2J8i9K"
4
+ }
@@ -6,13 +6,13 @@
6
6
  <title>
7
7
  Class: FormGenerator
8
8
 
9
- &mdash; Documentation by YARD 0.9.37
9
+ &mdash; 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 = "FormGenerator";
@@ -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>
@@ -96,7 +98,8 @@
96
98
 
97
99
  <dl>
98
100
  <dt>Defined in:</dt>
99
- <dd>lib/generators/form/form_generator.rb</dd>
101
+ <dd>lib/generators/form/form_generator.rb
102
+ </dd>
100
103
  </dl>
101
104
 
102
105
  </div>
@@ -139,6 +142,7 @@
139
142
 
140
143
 
141
144
  </ul>
145
+
142
146
 
143
147
 
144
148
 
@@ -183,11 +187,11 @@
183
187
  </div>
184
188
 
185
189
  <div id="footer">
186
- Generated on Mon Jan 13 17:26:04 2025 by
190
+ Generated on Tue Aug 25 18:22:24 2026 by
187
191
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
188
- 0.9.37 (ruby-3.3.1).
192
+ 0.9.45 (ruby-4.0.6).
189
193
  </div>
190
194
 
191
195
  </div>
192
196
  </body>
193
- </html>
197
+ </html>