samedi 28 février 2015

Ember this.store with deep path /:type/:id

In my application I have a profile page, each profile have an :type and :id, both are needed for queries.


route.js:



this.route('profile', {path: '/profiles/:type/:id'});


In my route I wish search for the current accessed profile,:



export default Ember.Route.extend({
model(params) {
var network = params.network;
var id = params.id;
var profile = this.store.find('profile', network, id});
}
});


and an model profile:



var attr = DS.attr;

export default DS.Model.extend({
name: attr('string'),
description: attr('string'),
});


MOCK like model: // /:network/:id res.send({ 'profiles': [{ //... }] });


But in my this.store.find('profile', network, id}); Ember throws: "Error while processing route: profile Assertion Failed: metaForProperty() could not find a computed property with key '0'. Error: Assertion Failed: metaForProperty() could not find a computed property with key '0'"


is this because I'm using RESTAdapter? ./adapters/application


How can I resolve it ?





Aucun commentaire:

Enregistrer un commentaire