jeudi 25 juin 2015

Ember Data One to Many by parent id only

I have a model, Parent. Every Parent has many Children objects but I don't want to have to embed the list of children ids in the parent object from the api.

eg. parent object looks like this when it comes down over the wire:

{
    id: 1111,
    name: "foo"
}

child object looks like this.

{
    id:2222
    parent_id : 1111,
    name: "bar"
}

I want store.find( 'parent', 1111) to go and fetch the Children too by the parent id

http://ift.tt/1LDLUKN

How can I do this in an ember data model?




Aucun commentaire:

Enregistrer un commentaire