abuiles / ember-cli-101-errata

18 stars 4 forks source link

Some problems with nested articles index #215

Closed bennyz closed 9 years ago

bennyz commented 9 years ago

I use only this.route because of #214 , however I am not sure this is related. When I created app/templates/articles/index.hbs as it says on page 58 and changes app/templates/friends/index.hbs to {{ link-to friend.fullName "articles" friend}} as it says on page 59, it threw an error "The router did not find 'articles.index" and indeed it was not on the router list.

I tried changing it friends.show.articles (because this one was in route list in the inspector), but it did not render anything, and I realized this is because the template path does not match the route's default. I moved app/templates/articles/index.hbs to app/templates/friends/show/articles/index.hbs and it worked as expected, but I am not sure if this is the correct way to do this.

I'd be happy for some clarification on this matter.

EDIT: This approach causes problems when trying to show the list and causes duplicate files. To get around this, it is possible to add the "resetNamespace: true" option to the route in order to make it behave like this.resource It would look like:

this.route('show', { path: ':friend_id' }, function() {
  this.route('articles', { resetNamespace: true }, function() {});
});
abuiles commented 9 years ago

@Bennyz thanks! I fixed this too, the issue is that we were using resources ,now has been updated to use routes and explains resetNamespace :)