There are Strong Parametrs:
params.require(:author).permit(:firstname, :secondname, :patronymic, :position, :data) The data field is of JSON type, the database is PG
When saving / updating, the field remains empty.
I tried to write:
props = params.require(:author).permit(:firstname, :secondname, :patronymic, :position, :data) props[:data] = params[:author][:data] So:
props = params.require(:author).permit(:firstname, :secondname, :patronymic, :position, :data) props[:data] = params[:author][:data].to_hash Tries to make an association and naturally nothing happens. I tried converting to json, but this is a string after all:
props = params.require(:author).permit(:firstname, :secondname, :patronymic, :position, :data) props[:data] = params[:author][:data].to_json Postgres on data type swears.
To sort through the controller is a lot and somehow wrong. But there is a need to store data with dynamic fields and the ability to sample them.
Thank you for your help!
:author>:data. By the way, what do you send there? - D-side