Ember.js 可选的belongsTo关系未推送到存储
我遇到了一个问题,可选的belongsTo关系没有正确地推送到存储区。在我的余烬应用程序中,我有两个可选模型之间的关系。例如,想象一下:Ember.js 可选的belongsTo关系未推送到存储,ember.js,ember-data,Ember.js,Ember Data,我遇到了一个问题,可选的belongsTo关系没有正确地推送到存储区。在我的余烬应用程序中,我有两个可选模型之间的关系。例如,想象一下: App.User = DS.Model.extend({ profile: DS.hasMany('profile', {'async': true}) }); App.Profile = DS.Model.extend({ user: DS.belongsTo('user', {'async': true}) }); 其中“配置文件”模型中的“用
App.User = DS.Model.extend({
profile: DS.hasMany('profile', {'async': true})
});
App.Profile = DS.Model.extend({
user: DS.belongsTo('user', {'async': true})
});
其中“配置文件”模型中的“用户”字段可以为空。当它为空时,序列化程序应返回
....
relationships: {
user: null
}
...
在规范化负载中,至少如果我正确解释了JSON-API标准()。问题是,这似乎没有被推到商店。我可以通过
这是预期行为还是错误?如果这是预期的行为,我应该如何跟踪这些更改以保持数据完整性?再次查看JSON-API后,似乎我对它的解释是错误的。标准化的有效负载应该是
...
relationships: {
user: {
data: null
}
}
...
这帮我解决了问题 再看一眼JSON-API,我似乎把它解释错了。标准化的有效负载应该是
...
relationships: {
user: {
data: null
}
}
...
这帮我解决了问题