Rails: updating an item along with associated items

Posted by shmichael on Stack Overflow See other posts from Stack Overflow or by shmichael
Published on 2010-05-05T14:54:04Z Indexed on 2010/05/05 14:58 UTC
Read the original article Hit count: 108

Filed under:

Suppose I have a simple to-do list application. The application contains two models:

  • lists (have an owner and description)
  • items (have name and due-date) that belong to a specific list

I would like to have a single edit screen for a list in which I update the list attributes (such as description) and also create/delete/modify associated items. There should be a single "save" button that will commit all changes. Unless save is pressed, any change to the list and the items should be forgotten.

I wasn't able to find an elegant best practice for this. Would greatly appreciate any suggestions and/or references to existing implementations.

© Stack Overflow or respective owner

Related posts about ruby-on-rails