1
我正在使用此序列化程序來使用字符串作爲編號,問題在於當我嘗試使用HasMany時出現了一個非常奇怪的錯誤關係:Ember-data HasMany使用字符串作爲編號時的關係
TypeError: d is undefined @ localhost/ember-jsonmin/js/libs/ember-data.min.js:10
串行器:
App.TopologyminSerializer = DS.RESTSerializer.extend({
normalize: function(type, hash, property) {
// Ember Data use the zone name as the ID.
hash.id = hash.siteGroup;
// Delegate to any type-specific normalizations.
return this._super(type, hash, property);
}
});
App.SiteSerializer = DS.RESTSerializer.extend({
normalize: function(type, hash, property) {
// Ember Data use the zone name as the ID.
hash.id = hash.name;
// Delegate to any type-specific normalizations.
return this._super(type, hash, property);
}
});
型號:
App.Topologymin = DS.Model.extend({
siteGroup: DS.attr('string'),
sites: DS.hasMany('site')
});
App.Site = DS.Model.extend({
name: DS.attr('string'),
hosts: DS.attr()
});
的問題是使用最小余燼數據庫。非常感謝你的幫助,我學到了新東西。 – Pedro4441