Skip to content

Commit 1ab1509

Browse files
committed
Prepare version 0.2.0
1 parent 78ccfaf commit 1ab1509

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## [Unreleased]
22

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+
37
## [0.1.0] - 2024-11-30
48

59
- Initial release

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,27 @@ class UsersController < ApplicationController
211211
@users = @form.results
212212
end
213213
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+
```

lib/hyper_active_form/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module HyperActiveForm
4-
VERSION = "0.1.0"
4+
VERSION = "0.2.0"
55
end

0 commit comments

Comments
 (0)