reactive_component 0.6.2 → 0.7.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 +11 -0
- data/app/controllers/reactive_component/actions_controller.rb +1 -1
- data/lib/reactive_component/version.rb +1 -1
- data/lib/reactive_component.rb +9 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a63e206cf0f143eb6c390357606b7de7bd67d8c516867883d3c125b865ff664
|
|
4
|
+
data.tar.gz: ab1e03efda80cff6207b6e7828bc42cdd23cf207953f803a620ccea143719a6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2476e8ed1dcef187d6abfe7b011cbb8e076ac41ac0cd266b48f4174ec1c4f503ba618d8eb104c19d288f18d694a74d57e2fa2c0e591ded079113d99dc166ee7f
|
|
7
|
+
data.tar.gz: 5f6aae9647f439578c0585d3ba66586c60442a75003531c9a98e8ce0f267c77fd3089830ce9d5c17f3c91638ffd5b3c13f4ba7533d638f4c7d90da92d80f43b5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0] - 2026-09-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `live_action` params are filtered with `permit` against the declared
|
|
7
|
+
list, so a nested hash or array sent for a scalar param no longer reaches
|
|
8
|
+
the action method.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `live_action` `params:` accepts the full `permit` spec, so an action can
|
|
12
|
+
declare arrays and nested hashes: `params: [:title, { tags: [] }]`.
|
|
13
|
+
|
|
3
14
|
## [0.6.2] - 2026-09-06
|
|
4
15
|
|
|
5
16
|
### Changed
|
data/lib/reactive_component.rb
CHANGED
|
@@ -192,9 +192,12 @@ module ReactiveComponent
|
|
|
192
192
|
end
|
|
193
193
|
end
|
|
194
194
|
|
|
195
|
+
# `params:` takes the same spec as `ActionController::Parameters#permit`:
|
|
196
|
+
# live_action :move, params: [:label_id]
|
|
197
|
+
# live_action :save, params: [:title, { tags: [], address: [:city] }]
|
|
195
198
|
def live_action(action_name, params: [])
|
|
196
199
|
self._live_actions = _live_actions.merge(
|
|
197
|
-
action_name.to_sym => { params: Array(params)
|
|
200
|
+
action_name.to_sym => { params: Array(params) }
|
|
198
201
|
)
|
|
199
202
|
end
|
|
200
203
|
|
|
@@ -213,13 +216,11 @@ module ReactiveComponent
|
|
|
213
216
|
instance = allocate
|
|
214
217
|
instance.instance_variable_set(:"@#{live_model_attr}", record)
|
|
215
218
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
instance.send(action_name)
|
|
222
|
-
end
|
|
219
|
+
# `permit` (not `permit!` + slice): only declared keys, and only scalar
|
|
220
|
+
# values, so a nested hash or array never reaches the action method.
|
|
221
|
+
action_params = ActionController::Parameters.new(action_params) unless action_params.is_a?(ActionController::Parameters)
|
|
222
|
+
filtered = action_params.permit(*action_config[:params]).to_h.symbolize_keys
|
|
223
|
+
instance.send(action_name, **filtered)
|
|
223
224
|
end
|
|
224
225
|
|
|
225
226
|
def compiled_data
|