Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ember model.reload() is not a function?

Tags:

model

ember.js

I want to reload my model in my controller,and I read the document from here

so I defined the action:reload in my controller and route both,such as:

 reload:function(){
     this.get('model').reload();
   }

when I triggered the action use this.send('reload'),it comes out the error this.get(...).reload is not a function,so did I misunderstand the document?

like image 854
TommyLike Avatar asked Jul 30 '15 06:07

TommyLike


1 Answers

Check that your model is not a collection. You can only reload a record. If your model is a collection you should do the following:

reload:function(){
     this.get('model').forEach(function(record){
        record.reload();
     });

   }
like image 187
Jav_Rock Avatar answered Sep 30 '22 06:09

Jav_Rock