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

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
} else {
// 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
this._setInclude(key, value, options);
return;
......@@ -454,7 +454,7 @@ Instance.prototype._setInclude = function(key, value, options) {
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);
} else {
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!