File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ def self.camelize_props(props)
13
13
when Array
14
14
props . map { |item | camelize_props ( item ) }
15
15
else
16
- props
16
+ if defined? ( ActionController ::Parameters ) && props . is_a? ( ActionController ::Parameters )
17
+ camelize_props ( props . to_h )
18
+ else
19
+ props
20
+ end
17
21
end
18
22
end
19
23
end
Original file line number Diff line number Diff line change @@ -28,4 +28,23 @@ def test_it_camelizes_props
28
28
29
29
assert_equal expected_props , React . camelize_props ( raw_props )
30
30
end
31
+
32
+ def test_it_camelizes_params
33
+ raw_params = ActionController ::Parameters . new ( {
34
+ foo_bar_baz : 'foo bar baz' ,
35
+ nested_keys : {
36
+ qux_etc : 'bish bash bosh'
37
+ }
38
+ } )
39
+ permitted_params = raw_params . permit ( :foo_bar_baz , nested_keys : :qux_etc )
40
+
41
+ expected_params = {
42
+ 'fooBarBaz' => 'foo bar baz' ,
43
+ 'nestedKeys' => {
44
+ 'quxEtc' => 'bish bash bosh'
45
+ }
46
+ }
47
+
48
+ assert_equal expected_params , React . camelize_props ( permitted_params )
49
+ end
31
50
end
You can’t perform that action at this time.
0 commit comments