hyperactiveform 0.4.0 → 0.4.1
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 +4 -0
- data/lib/hyper_active_form/base.rb +5 -1
- data/lib/hyper_active_form/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09dd7c7b6ba5fb3243de557d5a334e20139c69bb8e2d5ab3986eafb63a8e5f83'
|
4
|
+
data.tar.gz: eef1dbc8453404b09a9801b9d6d4d21d54ab49bed96c50aabf8ee51afbb38c63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd2a315077081fa9ae68cbf1938c1167e38a83db60168666c048f1cf5cf7b4e477062ec203375a0692a208480d86bd31e3652d70b7a8118c4a9b10026b218ba7
|
7
|
+
data.tar.gz: f9872fc6a83440e314a776c3ee604c3fb6a36666ebe5159342d81b7a2aa3ec4638f292ec5a2bcbd6fd3ccfa768bcd784bbdeeedbe8b18e6a4449ac81b376c816
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.4.1] - 2025-05-12
|
4
|
+
- Fixes a bug where if params contained expected falsey values, the form would treat them as nil.
|
5
|
+
for instance `form.submit({likes_cat: false})` would set `likes_cat` to nil instead of false.
|
6
|
+
|
3
7
|
## [0.4.0] - 2025-01-13
|
4
8
|
- Add `assigned_attribute_names` method to get the list of attributes that have been assigned during the last call to `assign_form_attributes` or `submit`.
|
5
9
|
This is useful in a context where you want to know which attributes have been passed to the form and only act on them rather than the whole attributes hash that might be partly empty (in API calls for example)
|
@@ -55,7 +55,11 @@ module HyperActiveForm
|
|
55
55
|
params = ActionController::Parameters.new(params) unless params.is_a?(ActionController::Parameters)
|
56
56
|
attribute_names.each do |attribute|
|
57
57
|
default_value = self.class._default_attributes[attribute]&.value_before_type_cast
|
58
|
-
|
58
|
+
if params&.key?(attribute)
|
59
|
+
public_send(:"#{attribute}=", params&.dig(attribute))
|
60
|
+
else
|
61
|
+
public_send(:"#{attribute}=", default_value)
|
62
|
+
end
|
59
63
|
end
|
60
64
|
@assigned_attribute_names = params.slice(*attribute_names).keys
|
61
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyperactiveform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Siami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
rubygems_version: 3.5.
|
133
|
+
rubygems_version: 3.5.9
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Simple form objects for Rails
|