将Ember v1.8 beta 3+与Ember Data 1.0 beta 10一起使用 - 您收到此错误:
Error while processing route: index Cannot read property 'async' of undefined TypeError: Cannot read property 'async' of undefined
at Relationship [as _super$constructor] (http://builds.emberjs.com/canary/ember-data.js:9523:46)
at new BelongsToRelationship (http://builds.emberjs.com/canary/ember-data.js:9736:12)
at createRelationshipFor (http://builds.emberjs.com/canary/ember-data.js:9840:16)
at http://builds.emberjs.com/canary/ember-data.js:6366:41
at http://builds.emberjs.com/canary/ember-data.js:9307:20
at cb (http://builds.emberjs.com/ember-latest.js:15907:13)
at OrderedSet.forEach (http://builds.emberjs.com/ember-latest.js:15703:13)
at Map.forEach (http://builds.emberjs.com/ember-latest.js:15911:19)
at Function.Model.reopenClass.eachRelationship (http://builds.emberjs.com/canary/ember-data.js:9306:42)
at Ember.Object.extend._setup (http://builds.emberjs.com/canary/ember-data.js:6365:26)
尽管您的模型设置正确:
App.Color = DS.Model.extend({
color: DS.attr(),
foo: DS.belongsTo('foo', {async:true})
});
App.Foo = DS.Model.extend({
foo: DS.attr()
});
答案 0 :(得分:12)
这是Ember / Ember数据版本的错误。 Ember在Ember 1.8 beta 3中改变了它的Map实现,使任何版本的Ember Data都低于1.0 beta 10。
这是github问题:https://github.com/emberjs/data/issues/2323
它已在1.0.0-beta.11 + canary.2997e47034或更高版本中修复。