What is a common usage of routes created with no URL in a nesting resources?


#1

Here is an example from Emberjs.com for the nesting resources.

App.Router.map(function() {
  this.resource('post', { path: '/post/:post_id' }, function() {
    this.route('edit');
    this.resource('comments', function() {
      this.route('new');
    });
  });
});

As it is explained in the site, this will create the post route and the comments route that has no URL mapped for each.

Then, What could be a good usage example for using these routes? because I just could use the post.index route and comments.index route with having a URL mapped for each?

Thanks much in advance.


#2

As for many things Ember favors “convention over configuration” so that when you do not specify a path for a route a default one is created with default naming convention (same for controllers, views etc).

In this case you will have a /post/:post_id/edit route.

See http://emberjs.com/guides/routing/defining-your-routes/