How can I allow a JSON array POST to my API endpoint through strong parameters?
Assuming I have the following JSON:
{
"objects": [
{
"attr1": "hi",
"attr2": "hi2"
},
{
"attr1": "hi",
"attr2": "hi2"
}
]
}
How can I get Rails to fit this into its params? I currently get an obscure Unprocessed Entity
response when I post the request to my create action.
I have tried both params.require(:objects)
and params.require(objects: [])
, to no luck. Any ideas?
Turns out I had a silly typo in my Content-Type header.