Problems using nested_attributes and Devise

Asked

Viewed 24 times

0

I’m creating a user settings form that uses Devise, I’m using nested Attributes, but for some reason the settings record is not updated, but deleted, someone has any idea what might be going on?

Form: https://pastebin.com/LphpYGCj Console log: https://pastebin.com/VLNjSA6u

(It also has this id that is passed in the form via a hidden_input that I would like to remove)

Thank you for your attention!

1 answer

0

Yes, I was being very stupid and I forgot about the importance of id, it was only leaving the same as allowed attribute that started to occur the update and not Destroy. But the id is saved with "hidden_field", which is a tremendous security flaw to leave it like this, so I created a logic in the controller to get the user’s id of the server without receiving via form, and disabled the id via hidden_input using "include_id: false" on "fields_for".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.