samedi 14 novembre 2015

queryRecord returns a class object instead of the record I expect

I'm using ember-cli-mirage to stub out the API, in the config I have this

this.get('/users',function(db,request){
  if(request.queryParams.short_url){
    var short_url = request.queryParams.short_url;
    return db.users.where({short_url: short_url});
  } else {
    console.log('no query params');
    return db.users;
  }
});

In my index route I have the model hook setup as such

model(params) {
  return this.store.queryRecord('user',{short_url: params.short_url});
}

But that's not returning me my user model from mirage, when I cast that to a variable and log it to the console I get a class object instead.




Aucun commentaire:

Enregistrer un commentaire