structured_params 0.9.0 → 0.9.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/structured_params/type/array.rb +16 -2
- data/lib/structured_params/version.rb +1 -1
- 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: 7df8a9794d83f7ff21ab449fcc1c8d294ef6fcc2f07efa3f06312847efd98351
|
|
4
|
+
data.tar.gz: 06b6b58ad9d4b5969ae944a4d84b49cb7eb163c8096ced05d345384b418ad651
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c67223de7d299fc05e4edb7d3f07a662ab08517f1fd515ecd20b5fed2bcbd9c1415a91ec64ec96ca71d79e584eb456b56e3a16ca1e5877f75c837f0be4817a3
|
|
7
|
+
data.tar.gz: a219e6a26311d776b6b68c3dee2a0ea40bc7faf4cbb00cf55fd9f390e3594bb862514aff5fc833477540bac3acf3f6173e08c97026379369b8bd6fd6019bcfcf
|
data/CHANGELOG.md
CHANGED
|
@@ -45,11 +45,25 @@ module StructuredParams
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# Get permitted parameter names for use with Strong Parameters
|
|
48
|
+
#
|
|
49
|
+
# Returns:
|
|
50
|
+
# - For object arrays (value_class): nested keys from the object
|
|
51
|
+
# Example: HobbyParams with [:name, :level]
|
|
52
|
+
# → returns [:name, :level]
|
|
53
|
+
# → becomes { hobbies: [:name, :level] } in Params#permit_attribute_names
|
|
54
|
+
#
|
|
55
|
+
# - For primitive arrays (value_type): empty array
|
|
56
|
+
# Example: attribute :tags, :array, value_type: :string
|
|
57
|
+
# → returns []
|
|
58
|
+
# → becomes { tags: [] } in Params#permit_attribute_names
|
|
59
|
+
# → finally used as params.permit(:name, { tags: [] })
|
|
60
|
+
#
|
|
48
61
|
#: () -> ::Array[untyped]
|
|
49
62
|
def permit_attribute_names
|
|
50
|
-
return
|
|
63
|
+
return @item_type.permit_attribute_names if item_type_is_structured_params_object?
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
# Primitive arrays return [] for Strong Parameters format
|
|
66
|
+
[]
|
|
53
67
|
end
|
|
54
68
|
|
|
55
69
|
# Determine if item type is StructuredParams::Object
|