加载路径时出错:TypeError:无法设置undefined的属性'store'

时间:2014-04-19 03:28:28

标签: ember.js

尝试让一个与Ember合作的hasMany关系但遇到问题

我的REST服务中的用户json包含usertag

{"user":
        [{"id":1,"name":"dolores.","email":"kuhlman@stha123n.com",
        "usertag":
                 [{"id":16,"userid":1}]}]}

除非我尝试在下面使用usertag关系

,否则一切都可以从商店检索用户

User.rb

App.User = Ember.Model.extend
    usertag: DS.hasMany('usertag') 

加载路径时出错:TypeError:无法设置未定义的属性'store'

Usertag.rb

App.Usertag = Ember.Model.extend
    userid: DS.attr 'string'

任何人都可以看到我犯了错误吗?

由于 !

版本信息..

Ember      : 1.5.1+pre.07fafb84 ember.js?body=1:3524
Ember Data : 1.0.0-beta.7.f87cba88 ember.js?body=1:3524
Handlebars : 1.3.0 ember.js?body=1:3524
jQuery     : 1.11.0 

堆栈:

Error while loading route: TypeError: Cannot set property 'store' of undefined
at Ember.Object.extend.modelFor (http://localhost:3001/assets/ember-data.js?body=1:9815:23)
at Ember.Object.extend.recordForId (http://localhost:3001/assets/ember-data.js?body=1:9268:21)
at deserializeRecordId (http://localhost:3001/assets/ember-data.js?body=1:10199:27)
at deserializeRecordIds (http://localhost:3001/assets/ember-data.js?body=1:10213:9)
at http://localhost:3001/assets/ember-data.js?body=1:10179:11
at http://localhost:3001/assets/ember-data.js?body=1:8520:20
at http://localhost:3001/assets/ember.js?body=1:3431:16
at Object.OrderedSet.forEach (http://localhost:3001/assets/ember.js?body=1:3274:10)
at Object.Map.forEach (http://localhost:3001/assets/ember.js?body=1:3429:10)
at Function.Model.reopenClass.eachRelationship (http://localhost:3001/assets/ember-data.js?body=1:8519:42) 

1 个答案:

答案 0 :(得分:0)

根据您的序列化程序,在jSON中,“usertag”应该是“usertags”,我认为。