For my CBT project, I have the following specification:
A user, to register a production item, needs to report all of their ingredients. To facilitate the interaction, I thought of, listing all the ingredients registered in checkboxes. When the user clicks on a certain link, a JavaScript function will count the marked checkboxes, and from there will create in a div the text fields corresponding to each ingredient so that the user can enter the quantity of each one. How accidental markings can happen , in the div with the inputs, it should still be possible for the user to delete the unwanted fields by clicking on a link.
My question is about the back end. How can I save this in the database? How will I capture the quantities in each field if they are not previously created in the .html.erb file?