0
votes

I'm just starting Ember and am having problems with a route called posts.images.

In my router, I have:

this.resource('posts', function(){
    this.resource('images', { path: ':post_id' });
    this.resource('newpost', { path: 'new' });
    this.resource('post', { path: ':post_id' });
});

My Route is:

Hex.PostImagesRoute = Ember.Route.extend({  // same with Hex.PostsImagesRoute
    model: function(params) {
        console.log('alert postimages');
        return Hex.Post.findById(params.post_id);
    }
});

and in my template I have:

{{#link-to 'posts.images' id}}images{{/link-to}}

But I get the following error:

Assertion failed: The attempt to link-to route 'posts.images.index' failed. The router did not find 'posts.images.index' in its possible routes: 'loading', 'e

I have read the http://emberjs.com/guides/routing/defining-your-routes/ but am not sure what I'm doing wrong. Any help would be appreciated.

thx

1

1 Answers

3
votes

Scroll down a bit:

NOTE: If you define a resource using this.resource and do not supply a function, then the implicit resource.index route is not created.

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