I have an array of objects being passed to my controller with this structure:
[
{
"id": 1,
"fruit_ids": [1, 2, 3]
},
{
"id": 2,
"fruit_ids": [4, 5, 6]
},
]
The root object, is not a {}, and instead is a array. I'm not sure how to write a strong params state for this case. I have tried
params.permit [:id, fruit_ids: []]
and other similar options, but it wasn't permitting it.
Edit:
I'm not sending a JSON object in my request body. I'm sending a JSON array. When I inspect the value of params in my controller, this is the result:
{
"_json" => [
{"id"=>1, "fruit_ids"=>[1, 2, 3]},
{"id"=>2, "fruit_ids"=>[4, 5, 6]}
],
"format"=>"json",
"controller"=>"...",
"action"=>"..."
}