ember.js 出现奇怪的问题:
TypeError: Object Status has no method 'eachRelatedType'
at DS.JSONSerializer.DS.Serializer.extend.configureSideloadMappingForType (http://localhost:5000/assets/ember-data.js?body=1:7798:10)
at DS.JSONSerializer.DS.Serializer.extend.sideload (http://localhost:5000/assets/ember-data.js?body=1:7768:10)
at DS.JSONSerializer.DS.Serializer.extend.extractMany (http://localhost:5000/assets/ember-data.js?body=1:7692:10)
at superWrapper [as extractMany] (http://localhost:5000/assets/ember.js?body=1:1240:16)
at DS.Adapter.Ember.Object.extend.didFindAll (http://localhost:5000/assets/ember-data.js?body=1:8307:16)
at http://localhost:5000/assets/ember-data.js?body=1:9894:15
at invokeCallback (http://localhost:5000/assets/ember.js?body=1:9754:19)
at publish (http://localhost:5000/assets/ember.js?body=1:9424:9)
at Promise.publishFulfillment (http://localhost:5000/assets/ember.js?body=1:9844:7)
at Object.DeferredActionQueues.flush (http://localhost:5000/assets/ember.js?body=1:5894:24)
当我的代码尝试显示状态列表时:
window.App = Ember.Application.create()
App.Status = DS.Model.extend
body: DS.attr('string')
App.StatusesRoute = Ember.Route.extend
model: ->
@get('store').findAll 'Status'
App.Router.map ()->
@resource 'statuses'
DS.RESTAdapter.reopen({ namespace: "api/v1" });
DS.RESTAdapter.configure("plurals", {
status: "statuses"
});
App.Store = DS.Store.extend
revision: 12
adapter: DS.RESTAdapter.create()
模板:
status.handlebars:
参赛作品...
{{#each status in controller}}
{{render "status" status}}
{{/each}}
statuses.handlebars:
{{身体}}
杰森:
{"statuses":[{"id":2,"body":"Test","user_id":3}]}
版本:
DEBUG: Ember : 1.4.0 ember.js?body=1:3462
DEBUG: Handlebars : 1.3.0 ember.js?body=1:3462
DEBUG: jQuery : 1.10.2
谁能看到我做错了什么?真的在努力解决这个问题,一定很简单:)
谢谢堆!