I'm building a backend API with Rails 4.2.4 and came across this problem.
From the client I'm sending to the server a JSON payload of this structure:
{
"Object":{
"A": {...}
"B": "..."
"C": "..."
}
}
In the Object
model that I created I have only attributes B
and C
, I would like to permit A
to be sent in (optional), so I did
def object_params
params.required(:object).permit(:A, :B, :C)
end
I thought this would do, but when I sent in the actual POST request, the server showed the following message:
Unpermitted parameter: A
.
Is there anything that I missed? Thanks!