Im using Cocoon gem(https://github.com/nathanvda/cocoon) in my Rails 4 application connected to a Postgres database for building a nested model form. I have permitted the attributes of the nested model (owner) in my projects controller as follows
params.
require(:project).
permit(:name, :description,
owners_attributes: [:name, :email, :miscellanous, :_destroy])
miscellanous column in owners table is of type json . Im unable to specify miscellanous correctly in the required params above. Suppose miscellanous can have the following keys: favorite_color and favorite_movie. How can i specify that in the strong params above ?
If i do the following:
params.
require(:project).
permit(:name, :description,
owners_attributes: [:id, :_destroy, :name, :email, miscellanous_attributes: [:favorite_color, :favorite_movie] ])
I get syntax error, unexpected ']', expecting =>
How can i correctly permit the json column called miscellanous for the nested model owners using strong params ?