Let’s say you have a library of books subdivided according to collections. One day you have acquired a new book and it will require a new collection as well.
Do you:
A) Go to /collections/add to create a new Collection and then redirect to /books/add/id (where id is the Collection.id)?
B) Go to /collections/add to create a new Collection but make the view file include Book fields and create both at the same time in the Collections controller?
C) Show /books/index organized by Collection and have links next to each that go to /books/add/id (where id is the Collection.id) … and also have one link for (add Book to new Collection) which goes to /books/add/ (no id) that can manage the Collection creation process before adding the new Book (but then you have to find a way to get a new Collection name from the user)?
D) Go to /books/add and when the Collections pulldown menu doesn’t include the needed Collection, redirect to /collections/add and then come back to /books/add to now see the just-added Collection?
E) Go to /books/add and make an ajax “new collection” routine within the view file in order to create the new Collection right there as needed?
F) Go to /books/add-to-new-collection and do it just like (b) above, except that your controller is Books and not Collections?
G) Something else?
Keep in mind:
- A collection just a container. Without any books, it is junk data. If the user creates a new collection, it should only be if there is also a new book for it. Likewise, deleting the last book in a collection should delete the collection as well.
- A book without a collection is “orphaned” and will lead to extra work in the GUI and for the user, so we’d rather avoid this situation as well.
- Moving a book from one collection to another, represents fixing a mistake… so it’s an unusual and rare task that maybe shouldn’t be technically possible which means books should be properly assigned to collections from the moment of creation
- The above three points mean many of the above strategies would need some form of “transactional” approach across more than one controller… some means to keep track of when an empty Collection or orphaned Book exist and rollback if that is the case.