hyperactiveform 0.1.0 → 0.2.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: 9bf33b760b731a44e34fd302e0d0d4049f9dd04cfeaeff043a32992f6a8c01d7
4
- data.tar.gz: 556cb734a8ee3eabf099240c26a709b19214b30e65d0c731e233e58b2984565f
3
+ metadata.gz: 2bf224bb05aa53c3ffa3909697c1de9aec078b5b2b93bb714c986406ec09c96a
4
+ data.tar.gz: cd9237240accc63066e2cbb43f52db7f43ba4f767d11dfbd648621988e5ca747
5
5
  SHA512:
6
- metadata.gz: 129e1e5a36f424767e7135339ade191302fd7b03cee66695abb9eaa4e274fb521a811d3bbd6b8c3e1fb8934e8a66c94ce75a7e99712ca3fe6bd40ee15949d670
7
- data.tar.gz: 381d63d878a72e386c4b0156be4836d54095b503e6640ebacbd2a4b441d924422b11bc583affc291a493c0514b0fcd57f46f9fdea917a7b9403fd36c1847f5fb
6
+ metadata.gz: 6b6c8634a4f830470618386a8e3b1b3dc0ef6b73808d5d74bdd45dd2f0a12f43983ae6a3cc5e0119cff0655a24f5e9902e674d3f78a01a182b743914e267b0f0
7
+ data.tar.gz: 78c2b176fdefc0c208ae01e5e884c5a324cd056a0f51177ebb27ca8be78dd93434bca7558814ab28bd79964a16dac9427119c2a422f60e6b117d49420b27142a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2024-12-14
4
+ - Add callbacks for `assign_form_attributes` and `submit`
5
+ - Change behavior of `assign_form_attributes`/`submit` to use the default value or nil if no value is provided, rather than keeping the value from `setup`
6
+
3
7
  ## [0.1.0] - 2024-11-30
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -22,7 +22,7 @@ And then execute:
22
22
 
23
23
  Run the install generator:
24
24
 
25
- $ rails generate hyperactiveform:install
25
+ $ rails generate hyper_active_form:install
26
26
 
27
27
  this will create an `ApplicationForm` class in your app/forms directory. You can use it as a base class for your form objects.
28
28
 
@@ -211,3 +211,27 @@ class UsersController < ApplicationController
211
211
  @users = @form.results
212
212
  end
213
213
  end
214
+ ```
215
+
216
+ ## Callbacks
217
+
218
+ HyperActiveForm provides callbacks for `assign_form_attributes` and `submit`.
219
+
220
+ You can use these callbacks to run code before or after assigning the form attributes or before or after submitting the form.
221
+
222
+ ```ruby
223
+ class ProfileForm < ApplicationForm
224
+ # ...
225
+
226
+ before_submit :do_something_before_submit
227
+ before_assign_form_attributes :do_something_before_assign_form_attributes
228
+
229
+ def do_something_before_submit
230
+ # Do something before submitting the form
231
+ end
232
+
233
+ def do_something_before_assign_form_attributes
234
+ # Do something before assigning the form attributes
235
+ end
236
+ end
237
+ ```