I have 2 models. Session and Error Now, session should have an array of errors - but the thing is that in the JSON I'm getting from the server - there is no session_id - so I cant use ember data has_many. I'm fetching the errors like so: (using ember_cli)
// routes/session.js
export default Ember.Route.extend(RouteMixin, {
model: function(params) {
params.paramMapping = {page: "page",
perPage: "page_size",
total_pages: "total_num_pages"};
return Ember.RSVP.hash({
session: this.get('store').find('session', params.session_id),
sessionErrors: this.store.find('error',{session_id: params.session_id})
});
}
});
How can I have sessionErrors
in Session
model properly?
I tried having an "array" transform:
//models/session.js
export default DS.Model.extend({
...
sessionErrors: DS.attr('array'),
...
});
But sessionErrors
gets undefined
Aucun commentaire:
Enregistrer un commentaire