Hey - I’ve been building out a sample application with Ember over the past few days and am running into a fairly large issue with the FixtureAdapter
and a hasMany
relationship.
I’m building a simple time tracking utility and want to be able to access multiple TimeEntry
records via a Task
.
There’s no trouble loading the Task
through it’s belongsTo
relationship from TimeEntry
, but going vice versa and getting the manyArray
of TimeEntry
objects doesn’t work.
Here’s the most simple implementation of the models. I’m just wondering if anyone has experience with getting this to work… Am I making some dumb mistake, or does this just plain not work?
App.Task = DS.Model.extend({
name: DS.attr(),
timeEntries: DS.hasMany('time_entry'),
});
App.Task.FIXTURES = [
{
id: 1,
name: 'Tracking time.',
time_entries: [1,2]
}
];
App.TimeEntry = DS.Model.extend({
startTime: DS.attr('date'),
endTime: DS.attr('date'),
task: DS.belongsTo('task')
});
App.TimeEntry.FIXTURES = [
{
id: 1,
startTime: "2013-11-29T04:52:17.249Z",
endTime: "2013-11-29T06:52:17.249Z",
task: 1
}, {
id: 2,
startTime: "2013-11-22T06:52:17.249Z",
endTime: "2013-11-21T06:52:17.249Z",
task: 1
}
];
Any help would be SO appreciated.
Thanks!