If I have a model like this:
App.Group = DS.Model.extend({
title: DS.attr('string'),
persons : DS.hasMany('App.Person')
});
App.Person = DS.Model.extend({
name : DS.attr('string'),
age : DS.attr('object'),
group : DS.belongsTo('App.Group')
});
And if I have fixture data like this:
App.Group.FIXTURES = [{
title : "Group A",
persons : [10,12]
},{
title: "Group B",
persons: [13,14]
}]
App.Person.FIXTURES = [{
name: "Bill",
age: 24
},{
name: "Ted",
age: 25
},{
name: "Mr. Excellent",
age: 30
},{
name: "Mr. Adventures",
age: 21
}]
And a template like this:
<script type="text/x-handlebars" data-template-name="Group">
{{title}}
{{render person}}
</script>
<script type="text/x-handlebars" data-template-name="Person">
{{#each in controller}}
{{name}}
{{/each}}
</script>
So what happens right now is the person template displays all the persons in the person array. How can I get the each loop to only go over the Persons in Group A, rather than displaying every Person in the fixture? Can this be done in handlebars? Or is this something I need to specify in the route?