I need to display the first item in an hasMany relationship
Basically a thread could have more than 1 author but I need to display only the first one in a particular template
I've the following json
{
threads: [
{
id: 1,
authors: [2,3]
}
],
authors: [
{
id: 2,
fullname: "foo"
},
{
id: 3,
fullname: "bar"
}
]
}
And the following models
App.Thread = DS.Model.extend({
authors: DS.hasMany('author')
});
App.Author = DS.Model.extend({
fullname: DS.attr('string')
});
now in my template I'm tring to do something like {{thread.authors[0].fullname}}
but it doesn't work. I've tried also thread.authors.0.fullname
according to the handlebars syntax but nothing changed.
Thnx in advance for your help