Errors and Forms with arrays

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 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