Say I have controller params
with the following structure:
{
"foo" => {
"id" => 123,
"children" => {
"0" => {
"a" => "a"
},
"1" => {
"b" => "b"
}
}
}
}
How can I permit all the data explicitly? I don't want to permit arbitrary data at any point in the hierarchy.
I had expected this work:
params.require(:foo).permit(:id, children: { "0" => [:a], "1" => [:b] })
However, it returns:
{ "id" => 123, "children" => { "0" => {}, "1" => {} } }
How can I whitelist the permitted attributes for each child?