I have a model, Node
:
App.Node = DS.Model.extend({
parents: DS.hasMany('node', { inverse: null })
});
Let's say my server is sending back a partial tree:
{ id: "A", parents: [ "C" ] }
{ id: "B", parents: [ "C", "D" ] }
{ id: "C", parents: [ "E" ] }
I want to render this like so:
A ---- C
/
B ---/
However, when I call B.get('parents')
, I get a message stating:
Uncaught Error: Assertion Failed: You looked up the 'parents' relationship on a 'node' with id B but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (
DS.hasMany({ async: true })
)
Neither of those are desirable to me. I want just the loaded records in the graph.
I may eventually want to render something like this as well:
A ---- C--?
/
B ---/--?
Representing unimportant parents with a UI element.
Is there a way to peek only loaded records in a relationship?