不要怂,就是干,撸起袖子干!

You need to sign in or sign up before continuing.
Commit 35683cfe by Clement Teule

Fix issue #4353. After destroy and reload, a 1-1 association is set to null.

1 parent f2d2beaf
Showing with 2 additions and 2 deletions
...@@ -312,7 +312,7 @@ Instance.prototype.set = function(key, value, options) { // testhint options:non ...@@ -312,7 +312,7 @@ Instance.prototype.set = function(key, value, options) { // testhint options:non
} else { } else {
// Check if we have included models, and if this key matches the include model names/aliases // Check if we have included models, and if this key matches the include model names/aliases
if (this.options && this.options.include && this.options.includeNames.indexOf(key) !== -1 && value) { if (this.options && this.options.include && this.options.includeNames.indexOf(key) !== -1) {
// Pass it on to the include handler // Pass it on to the include handler
this._setInclude(key, value, options); this._setInclude(key, value, options);
return; return;
...@@ -454,7 +454,7 @@ Instance.prototype._setInclude = function(key, value, options) { ...@@ -454,7 +454,7 @@ Instance.prototype._setInclude = function(key, value, options) {
value = value[0]; value = value[0];
} }
isEmpty = value && value[primaryKeyAttribute] === null; isEmpty = (value && value[primaryKeyAttribute] === null) || (value === null);
self[accessor] = self.dataValues[accessor] = isEmpty ? null : include.model.build(value, childOptions); self[accessor] = self.dataValues[accessor] = isEmpty ? null : include.model.build(value, childOptions);
} else { } else {
isEmpty = value[0] && value[0][primaryKeyAttribute] === null; isEmpty = value[0] && value[0][primaryKeyAttribute] === null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!