You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 17, 2017. It is now read-only.
Rails & strong_parameters has no problem interpreting this and creating the data. However, due to the way the JSON request body is structured, Rails & strong_parameters simply just set the id and type fields.
This results in Rails not picking up on the added association, causing my after_add association callback not to trigger.
I have a line in one of my models that looks like this:
I am sending a POST request to my Rails endpoint with JSON like this:
{ "note": { "text": "Test note", "notable_id": 1, "notable_type": "AnotherModel" } }Rails & strong_parameters has no problem interpreting this and creating the data. However, due to the way the JSON request body is structured, Rails & strong_parameters simply just set the
idandtypefields.This results in Rails not picking up on the added association, causing my
after_addassociation callback not to trigger.