Forum: Ruby on Rails Forms with multiple item entry

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jake J. (Guest)
on 2006-01-22 04:22
Hello-

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?

   Jake
This topic is locked and can not be replied to.