简体   繁体   English

型号不适用于新的Ember数据升级

[英]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. 我已经设置了Ember on Rails进行一些练习,最初收集了我模型中的数据,但是在安装了新的捆绑软件之后,不再使用我模型中的数据。 I think it ' because the new Ember-data gem installed. 我认为是因为安装了新的Ember-data gem。

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? 如何使我的模型在About视图中再次起作用?

I am not sure why you have 2 App.About.Route but try this 我不确定为什么您有2个App.About.Route,但是请尝试一下

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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