ember.js - Ember: The response from a findQuery must be an Array, not undefined -


i'm trying implement search functionality calling api /search?q=test. api returns following object:

{     "categories" :      [         {             "id" : 77,             "name" : "animals",             "output" : {}         },          {             "id" : 167,             "name" : "fish",             "output" : {                 "image" : {                     "mimetype" : "image/png",                     "path" : "/images/fish.png"                 }             }         }     ],     "designs" : []     // more arrays here } 

here ember search model:

export default ds.model.extend({   categories: ds.hasmany('category'),   designs: ds.hasmany('design')   // more hasmany relationships here }); 

in search controller:

model: function (params) {   return this.store.find('search', { q: params.q }); } 

getting error "assertion failed: response findquery must array, not undefined".

i'm new ember feel need add search serializer not sure write in there. or maybe there else causing this. looks me should working fine it's not. advice?

with give code, try find (read: array of) searches. missing in reply, hence error.

what want

model: function (params) {   return this.store.find('category', { q: params.q }); } 

but lead request /categories?q=test. if, @ all, server code , interface controlled yourself, change server. if not, use customized restadapter (in ember-cli: ember g adapter category) custom pathfortype method.


Popular posts from this blog