Reputation: 1052
I have defined the following model with Ember Data:
App.Person = DS.Model.extend({
name: DS.attr('string'),
parent: DS.belongsTo('person'),
children: DS.hasMany('person')
});
Additionally, I've defined the following fixture data, which appropriately models the data, indicating that Ember Data has no problems modeling the data in this layout:
App.Person.FIXTURES = [
{id: 1, name: "Dylan", parent: 2},
{id: 2, name: "Stacey", children: [1,3]},
{id: 3, name: "Londyn", parent: 2},
{id: 4, name: "Kyle"}
];
When attempting to create a record, I get an incredibly unhelpful error message:
Uncaught #<error>
This only occurs when the children property is defined on the model. Removing it causes the record to be created successfully, without an error.
I've also made a simple example here.
Upvotes: 0
Views: 632