简体   繁体   中英

Models not working with the new Ember-data upgrade

I have set up Ember on Rails to do some practice, the data in my models were originally picked up but after the new bundle install, data in my models are not taken anymore. I think it ' because the new Ember-data gem installed.

Here the commit

The code

App.AboutRoute = Ember.Route.extend({
  model: function() {
    return App.Person.find();
  }
}); 

App.Person.FIXTURES = [
 {
   id:1,
   name: 'Tom'
 },
 {
   id: 2,
   name: 'Giorgio'
 },
 {
   id: 3,
   name: 'Laura'
 }
];

<script type="text/x-handlebars" data-template-name="about">
  <ul>
    {{#each person in model}}
      <li>{{person.name}}</li>
    {{/each}}
  </ul>
  About 
</script>



App.AboutRoute = Ember.Route.extend({
  model: function() {
    return App.Person.find();
  }
})

How can i make my models working again with the about view?

I am not sure why you have 2 App.About.Route but try this

App.AboutRoute = Ember.Route.extend({
  model: function() {
    return this.store.find('person');
  }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM