ember.js - Add Ember Data query helper method -
i'm using ember api json api backend. api accepts filters this:
/users?filter[simple][name]=john
right now, whenever want make query, i'm doing this:
this.store.query('users', { filter: { simple: { name: 'john' } } });
it nice avoid verbosity adding helper function works this:
this.store.simplequery('users', { name: 'john' });
that function pass arguments directly query()
, wrapping query in { filter: { simple: ... } }
.
is possible? how do this?
well stopping creating own method in adapter that?
// ... adapter code simplequery: function(modelname, query) { return this.store.query('users', { filter: { simple: { name: 'john' } } }); } // ...
Comments
Post a Comment