I ran into this very interesting problem which i am trying to resolve since last 3-4 hours, where i am not able to permit unknown nested array in json , its setting to empty array
params=ActionController::Parameters.new({"id"=>21, "tags"=>{"key"=>[["browser", "Chrome 28.0.1500"], ["browser.name", "Chrome"]]}, "nested_key"=>{"key_2"=>"value_2"}})
doing
params.permit(:id, tags: {}, nested_key: {})
is giving me nested array as empty("key"=>[])
,
#<ActionController::Parameters {"id"=>21, "tags"=>#<ActionController::Parameters {"key"=>[]} permitted: true>, "nested_key"=>#<ActionController::Parameters {"key_2"=>"value_2"} permitted: true>} permitted: true>
I want all nested elements of array to be permitted since its part of the json. Can anyone help me with this ? Please note that nested keys are dynamic which i will not be aware of while permitting.