mercredi 25 mars 2015

Ember data - return two resources in one requests

I want to implement search for e-shop. User enters text, and API returns products AND categories which matches search phrase.


How do I get products and categories in one request ?


I'm aware I could do



return Ember.RSVP.hash( {
products: this.store.find("product", {searchTerm: "banana"})
categories: this.store.find("category", {searchTerm: "banana"})
} );


but isn't there a way to do it in a single request in order to have a better performance ?





Aucun commentaire:

Enregistrer un commentaire