I have an Item model and a Cycle model. The item model belongs to cycle, and cycle has many items. The item model has a barcode value and cycle_id value.
I want to have a show cycle template that has 10 blank fields for entering barcode values. Assume 100 items (with barcode values but no cycle_id) already exist in the database. When the barcode values are entered in the fields, the application should pull each entered barcode value and update the associated item with the cycle_id of the currently selected cycle.
This may be too broad a question, but I’ve been spinning in circles for hours and I don’t even know where to begin. Any help is greatly appreciated. Thanks!
In your cycles new/edit form, I would add ten empty input boxes somewhere in your form. Not the greatest example of markup, but something like this:
Then in your cycles controller, I would find the cycle, then add all the barcodes that they entered. I’m assuming you don’t wan them to create new barcodes if they don’t exist. (This is Rails 3 syntax)