I need reload a model after a action. Look at documentation I see this http://emberjs.com/api/data/classes/DS.Model.html#method_reload
But when I call reload, I receive this.controller.get(...).reload
is not a function. How reload a model if a action, since occur this error?
model() {
return this.store.peekAll('place');
},
actions: {
reload() {
this.controller.get('model').reload().then(function(model) {
console.log(model);
})
},
}
Your problem is that peekAll()
method returns a filtered array that contains all of the known records for a given type in the store.
So you can not call reload
on a filtered array, you can do it only when you have a single record (model instance) fetched with peekRecord(type, recordId)
;