Routes added under existing routes wont work


#1

After updating Discourse I am having trouble getting routes that are created under an existing route to work. These are put under the ‘user’ resource. Has anything changed with the route maps. Here are my route definitions:

export default {
  resource: 'user',
  path: 'users/:username',
  map() {
    this.route('music', { path: '/music' }, function() {
      this.route('callback', { path: '/callback' });
      this.route('connect', { path: '/connect' });
      this.route('tracks', { path: '/tracks' });
    });
  }
}

Now, trying to use:

{{#link-to 'music' class='btn btn-primary btn-profile'}}

Gives me:

“Assertion Failed: You attempted to define a {{link-to "music"}} but did not pass the parameters required for generating its dynamic segments. There is no route named soundcloud”

If I pass the user object as a parameter to the link-to widget It renders correctly but the url only shows a ‘#’ after the current url. Clicking it gives me this:

“This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.”

It seems as if the ‘music’ route has never been created.

Edit: Actually, I realized I can access the url but the link-to widget won’t recognize the route name ‘music’. Should it contain anything before to tie it the the user path?


(Robin Ward) #2

If you’re adding it under user shouldn’t it be user.music when you link to it?

I highly recommend the Ember Inspector browser extension. It’ll list all your routes and show you what is defined.