File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 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)
1313 when Array
1414 props . map { |item | camelize_props ( item ) }
1515 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
1721 end
1822 end
1923end
Original file line number Diff line number Diff line change @@ -28,4 +28,23 @@ def test_it_camelizes_props
2828
2929 assert_equal expected_props , React . camelize_props ( raw_props )
3030 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
3150end
You can’t perform that action at this time.
0 commit comments