mercredi 21 septembre 2016

Ember Data mix of find(), query(), findAll()

If I do

this.get('store').findAll('model')

It will make a request to /models and it will expect for an array. On the other hand, if I do

this.get('store').find('model', my_id)

It will make a request to /models/my_id and it will expect for one record of my model. The method .query() will basically do a GET request with the parameters I pass like

this.get('store').find('model', {something: 'foo'})

It will make a request to /models?something=foo.

My question is the following:

Can I make something which mixes all the three methods above? I want to make a request to the path /models/foo and I want to expect one array.

I did .find('model', params.something), but it threw an assert exception saying that it was expecting for one model and not one array.




Aucun commentaire:

Enregistrer un commentaire