Rails: updating an item along with associated items
- by shmichael
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.