TypeError Ember.js

TypeError Ember.js,ember.js,routing,typeerror,Ember.js,Routing,Typeerror,所以,当谈到Ember时,我还是一个初学者,现在我正试图从Ember数据中理解子类DS.Model。因此,出于某种原因,当我发送到帖子时,它会出现以下错误: 处理路由时出错:未定义的帖子不是函数类型错误:未定义的帖子不是函数 将来,您应该发布包含错误的堆栈跟踪的其余部分,并指出错误发生在哪一行。当我们不知道错误发生在哪里时,我们真的很难追踪到错误 幸运的是,您的代码并不太复杂,我已经看到了足够多的余烬代码,可以猜测您正在模型上调用一个旧方法。使用App.Post.find()查找记录已经被弃用了

所以,当谈到Ember时,我还是一个初学者,现在我正试图从Ember数据中理解子类DS.Model。因此,出于某种原因,当我发送到帖子时,它会出现以下错误:

处理路由时出错:未定义的帖子不是函数类型错误:未定义的帖子不是函数


将来,您应该发布包含错误的堆栈跟踪的其余部分,并指出错误发生在哪一行。当我们不知道错误发生在哪里时,我们真的很难追踪到错误


幸运的是,您的代码并不太复杂,我已经看到了足够多的余烬代码,可以猜测您正在模型上调用一个旧方法。使用
App.Post.find()
查找记录已经被弃用了很长一段时间(看起来它也被删除了)。您应该改用
this.get('store').find('post')

ember文档仍在使用App.post.find(),这非常混乱。this.get('store')或this.store更好。您能给我指一下仍然在模型上使用
find
方法的文档吗?这一点绝对应该改变。你可以在下面看到其中的一些谢谢,我将提交一个请求来更改它并消除混淆。
App = Ember.Application.create();


App.Store = DS.Store.extend({
    revision: 12,
    //where do we have to look for those records?
    adapter: 'DS.FixtureAdapter'

});
App.Router.map(function() {
    this.resource('posts'); 
    this.resource('about');

});


App.PostsRoute = Ember.Route.extend({
    //we're returning all the data that our application knows about
    model: function() {
        return App.Post.find();
    }

});

App.Post = DS.Model.extend({
title: DS.attr('string'),
author: DS.attr('string'),
intro: DS.attr('string'),
extended: DS.attr('string'),
publishedAt: DS.attr('date')
});


App.Post.FIXTURES = [{
  id: '1',
  title: "Rails is Omakase",
  author: "d2h" ,
  date: new Date('12-27-2012'),
  excerpt: "There are lots of à la carte software environments in this world. Places where in order to eat, you must first carefully look over the menu of options to order exactly what you want.",
  body: "I want this for my ORM, I want that for my template language, and let's finish it off with this routing library. Of course, you're going to have to know what you want, and you'll rarely have your horizon expanded if you always order the same thing, but there it is. It's a very popular way of consuming software.\n\nRails is not that. Rails is omakase."
}, {
  id: '2',
  title: "The Parley Letter",
  author: "d2h" ,
  date: new Date('12-24-2012'),
  excerpt: "My [appearance on the Ruby Rogues podcast](http://rubyrogues.com/056-rr-david-heinemeier-hansson/) recently came up for discussion again on the private Parley mailing list.",
  body: "A long list of topics were raised and I took a time to ramble at large about all of them at once. Apologies for not taking the time to be more succinct, but at least each topic has a header so you can skip stuff you don't care about.\n\n### Maintainability\n\nIt's simply not true to say that I don't care about maintainability. I still work on the oldest Rails app in the world."  
}];