Let's say I've got an API with resource: /users/1
There are some user data for user who has id=1. Also, I have a resource: /users/1/photos
. All photos belonging to this user are accessible from here. My problem is to create a relation between user and photos, because user model doesn't have an array of photo ids. Furtheremore I believe I don't need a relation while there is a simple rule where to search for photos for this user. The best solution would be to do some magic in serializer or adapter, that when I'm on route like http://ift.tt/2hlEHJX
, I can access data from http://ift.tt/2hpkosT
- so it should behave as collection but with option to specify id ;) I'm using DS.RESTAdapter
lundi 12 décembre 2016
How to get collection of items binded to another item by id in Ember
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire