Ember中父/子关系出错

我正在使用Ember 1.5,Ember-Data 1.0.0-beta.7和祖先gem。

我有一个parentancestors模型,但任何具有parentancestor模型条目都会得到这个奇怪的错误并失败。

错误:

 Ember Inspector ($E): Error: No model was found for 'ancestor' at new Error (native) at Error.Ember.Error (http://localhost:8080/assets/ember.js?body=1:911:19) at Ember.Object.extend.modelFor (http://localhost:8080/assets/ember-data.js?body=1:9808:33) at JSONSerializer.extend.extractSingle (http://localhost:8080/assets/ember-data.js?body=1:3021:28) at superWrapper [as extractSingle] (http://localhost:8080/assets/ember.js?body=1:1293:16) at Ember.Object.extend.extractFind (http://localhost:8080/assets/ember-data.js?body=1:2483:21) at Ember.Object.extend.extract (http://localhost:8080/assets/ember-data.js?body=1:2368:37) at http://localhost:8080/assets/ember-data.js?body=1:10340:34 at invokeCallback (http://localhost:8080/assets/ember.js?body=1:10014:19) at publish (http://localhost:8080/assets/ember.js?body=1:9684:9) VM6302:164 

我已经注释掉了一堆代码,寻找我要求ancestor任何地方,但我找不到它。

下面是我目前正在使用的代码仍然抛出此错误。

 #models/dream_symbol.js.coffee attr = DS.attr App.DreamSymbol = DS.Model.extend description: attr 'string' image: attr 'string' name: attr 'string' parent_id: attr 'number' path: attr 'string' rails_id: attr 'number' thumbnail: attr 'string' user: DS.belongsTo 'user' parent: DS.belongsTo('dream_symbol', inverse: 'children' embedded: 'always' ) # ancestors: DS.hasMany('dream_symbol', # inverse: 'children' # embedded: 'always' # ) children: DS.hasMany('dream_symbol', inverse: 'parent' embedded: 'always' ) siblings: DS.hasMany('dream_symbol', inverse: 'siblings' embedded: 'always' ) interpretations: DS.hasMany('interpretation', embedded: 'always' ) serialize: -> @getProperties [ 'guid', 'image', 'name', 'description', 'parent', 'children', 'siblings', 'parent_id', 'interpretations', 'path', 'rails_id' ] 

我在上面的代码中注释掉并删除了对ancestor任何引用。 下面是我的路线,我已经完全注释掉了我的DreamSymbolShowController

 # Show Route App.DreamSymbolsShowRoute = Ember.Route.extend model: (params)-> @store.find 'dream_symbol', params.id actions: edit: -> @transitionTo 'dream_symbols.edit', @currentModel new: (params)-> referrer = @currentModel.get 'id' parent_id = ( if params then params.id else null ) @transitionTo('dream_symbols.new').then (newRoute)-> newRoute.controller.set 'previous', referrer newRoute.currentModel.set 'parent_id', parent_id 

有没有人想过要试着去研究为什么我会在子页面上出错而不是父页面,以及我能做些什么呢?

更新:

这是我正在获得的当前JSON响应:

 { ancestors: [ { id: "body-parts", name: "Body Parts", description: "Qoop", user_id: null, image: null, thumbnail: null, rails_id: 24 } ], children: [ ], parent: [ { id: "body-parts", name: "Body Parts", description: "Qoop", user_id: null, image: null, thumbnail: null, rails_id: 24 } ], siblings: [ { id: "root-level-child", name: "Hand", description: "ff", user_id: null, image: null, thumbnail: null, rails_id: 25 } ], dream_symbol: { id: "root-level-child", description: "ff", image: null, name: "Hand", parent_rails_id: 24, rails_id: 25, thumbnail: null, user_id: null, ancestors: [ "body-parts" ], children: [ ], parent: "body-parts", siblings: [ "root-level-child" ] } } 

我需要使用belongsTohasMany设置来更改。 有点难过这里。