Reputation: 41
I have two routes of which one of them uses a dynamic segment :
App.Router.map(function() {
this.resource('books');
this.resource('book', {
path: "/book/:book_uid"
})
});
When i try the helper {{link-to 'book' abook.uid}} in the Books template, I get the error :
Uncaught Error: More context objects were passed than there are dynamic segments for the route: book
This is the model for Book :
App.Book = DS.Model.extend({
book_id: DS.attr()
});
and this is how i define the route for Book :
App.BookRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('book', params.book_uid);
},
serialize: function(model) {
return {
book_uid: model.get('uid')
};
}
});
Any ember saints out there who can give a look see???
Upvotes: 3
Views: 4033
Reputation: 19128
When the link-to
helper is used in inline form the first parameter is used as the link text and the remaining args as your route path.
So you in your case you have to pass three args to it like this:
{{link-to 'Show book' 'book' abook.uid}}
Or use the block form in this way:
{{#link-to 'book' abook.uid}}
Show book
{{/link-to}}
Upvotes: 2