处理关系模型中的空值

时间:2015-10-06 03:53:05

标签: javascript ember.js ember-data

我将ember与parse数据库一起使用,并使用embe-parse-adapter

但我在获取记录后出现此错误

Error while processing route: index.index Cannot read property '_relationships' of null TypeError: Cannot read property '_relationships' of null

从我阅读的各种资源中,我怀疑它是因为在其中一个与其他模型有关系的字段中存在空值,

我怎么能处理这个?

javascript stacktrace是:

Error while processing route: index.index Cannot read property '_relationships' of null TypeError: Cannot read property '_relationships' of null
    at ember$data$lib$system$relationships$state$relationship$$Relationship.addCanonicalRecord (http://127.0.0.1:4200/assets/vendor.js:106486:19)
    at ember$data$lib$system$relationships$state$has$many$$ManyRelationship.addCanonicalRecord (http://127.0.0.1:4200/assets/vendor.js:106904:12)
    at ember$data$lib$system$relationships$state$has$many$$ManyRelationship.computeChanges (http://127.0.0.1:4200/assets/vendor.js:107005:14)
    at ember$data$lib$system$relationships$state$relationship$$Relationship.updateRecordsFromAdapter (http://127.0.0.1:4200/assets/vendor.js:106639:14)
    at http://127.0.0.1:4200/assets/vendor.js:111256:26
    at http://127.0.0.1:4200/assets/vendor.js:113058:20
    at Map.forEach.cb (http://127.0.0.1:4200/assets/vendor.js:23060:11)
    at OrderedSet.forEach (http://127.0.0.1:4200/assets/vendor.js:22853:11)
    at Map.forEach (http://127.0.0.1:4200/assets/vendor.js:23064:18)
    at Function.ember$data$lib$system$model$$default.reopenClass.eachRelationship (http://127.0.0.1:4200/assets/vendor.js:113057:83)

以及我使用的版本:

DEBUG: -------------------------------
DEBUG: Ember             : 1.12.0
DEBUG: Ember Data        : 1.0.0-beta.18
DEBUG: jQuery            : 2.1.4
DEBUG: Ember Simple Auth : 0.8.0-beta.1
DEBUG: -------------------------------

0 个答案:

没有答案