jeudi 12 février 2015

Adapter that converges two API sources into one model

Let's say I have a JSON API where I can access two models: cats and dogs. However, on my Ember application I only have one model: animals.


Although every time I save() an animal, it's POSTed to the API as a cat, if I receive a dog linked in any other model it should be locally stored as an animal by ember-data.


What would be the most coherent way to achieve this? Thank you!





Aucun commentaire:

Enregistrer un commentaire