Forum: Ruby on Rails Errors and Forms with arrays

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jake J. (Guest)
on 2006-01-26 05:53
Hello again-

I have a form with array information (like, say, items in a shopping
cart).  Each item has several fields (quantity, for example).

Is there a nice way to specify the tags so that:

1. Data is extracted easily.  They could be listed as "cart.items", for
example, but how to bring the updated data back into the array of
"items" without having to manually stuff it.

2. Errors are displayed near the item.  The way I'm doing it now is
looking at "@cart.items.each" and manually looking at item.errors.
Seems like a pretty good way to me.

3. Input fields are tagged.  This one seems to relate to #1.  I can look
at p.errors, but how to wrap the violating fields with the
errorsExplanation div.

This topic is locked and can not be replied to.