jeudi 9 janvier 2020

How to create checkboxes using scaffold in rails?

I have to create a feature to manage my contracts. Everything was going fine working with the strings etc.. but I have to create checkboxes in my scaffold for an example ()Toll ()Chemist And I want to save this if the boxes are checked.
I tried put this code into the Form file, it appears, but don't save the data when checked, I guess that is not the correct way, because there is nothing created in the database.

<input type="checkbox" name="tag_ids[]" value="1" />

I'm planning to generate all the checkboxes as strings when generating the scaffold and try something else. Does anyone have a better idea how can I accomplish this, could be the easiest way as possible is not for real development. Thanks for all.




Aucun commentaire:

Enregistrer un commentaire