Hacker News new | ask | show | jobs
by pyre 4227 days ago
Yes and no. Depends on how the routes are structured in the code. In your example:

  /users/
  /users/15/
  /users/15/photos/
Your router map probably looks like this:

  App.Router.map(function() {
    this.route('index', { path: '/' });
    this.resource('users', { path: '/users' }, function () {
      this.route('index', { path: '/' });
      this.route('show', { path: '/:user_id' });
      this.route('photos', { path: '/:user_id/photos' });
    });
  });
This translates into a structure like:

  ApplicationRoute
    IndexRoute
    UserRoute
      UsersIndexRoute
      UserShowRoute
      UserShowPhotosRoute
Note how all of those Users*Route classes are all siblings rather than in parent-child relationships. Also note that if you're sharing controllers, they won't pass through Route.setupController on the sibling routes because those routes aren't run.