Forms with multiple item entry


I was wondering what would be the simplest/cleanest way to have a view
offer entry fields for several items (e.g. the “quantity” for items in a
shopping cart).

If I have a model such as “cart” which has_many “items”, then I can use
“cart.items” to get an array of all of them. Each item has a quantity,
so I’d have “cart.items[n].quantity” that I would like to display and
allow the user to enter.

What’s the best way to present this (not so hard) and get it back into
the controller and save them. Does each one have to be save()'ed
independently or is there a convenient ‘array-save’ of some sort?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs