Ember: How can one structure nested routes when parent objects are not persisted (have no :id)?

56 Views Asked by At

How can one structure nested routes when parent objects are not persisted (have no :id)?

I'm basically building a object configuration wizard, where a book has several child configuration models. the user's path through the configuration is roughly:

  1. Users upload manuscripts, and the record is persisted.
  2. User transitions to book/configuration/cover
  3. User can go back and forth between various configuration subroutes.
  4. After configuring, user clicks to trigger persisting the parent and children.
  5. After the book is persisted, they could go back to edit.

Must I create two sets of routes - one for edit and one for new that omits the book.id in the path? Is there a way to do it in one go?

//my routes:
this.route('upload-manuscripts', function() {
  this.route('new');
});

Router.map(function() {
  this.route('book', {path: '/:id'}, function() {
    this.route('configuration', function() {
      this.route('cover');
      this.route('spine');
      this.route('pagination');
    });
  });
});

Thanks!

0

There are 0 best solutions below