diff --git a/addon/-private/system/model/internal-model.js b/addon/-private/system/model/internal-model.js index c30b9b13c39..bc3eb539422 100644 --- a/addon/-private/system/model/internal-model.js +++ b/addon/-private/system/model/internal-model.js @@ -875,12 +875,12 @@ export default class InternalModel { if (this._relationships.has(name)) { let rel = this._relationships.get(name); rel.clear(); - rel.destroy(); + rel.removeInverseRelationships(); } }); Object.keys(this._implicitRelationships).forEach((key) => { this._implicitRelationships[key].clear(); - this._implicitRelationships[key].destroy(); + this._implicitRelationships[key].removeInverseRelationships(); }); } @@ -888,11 +888,11 @@ export default class InternalModel { this.eachRelationship((name, relationship) => { if (this._relationships.has(name)) { let rel = this._relationships.get(name); - rel.destroy(); + rel.removeInverseRelationships(); } }); Object.keys(this._implicitRelationships).forEach((key) => { - this._implicitRelationships[key].destroy(); + this._implicitRelationships[key].removeInverseRelationships(); }); } diff --git a/addon/-private/system/relationships/state/has-many.js b/addon/-private/system/relationships/state/has-many.js index f961954d960..6f8e6fa4a72 100644 --- a/addon/-private/system/relationships/state/has-many.js +++ b/addon/-private/system/relationships/state/has-many.js @@ -46,8 +46,8 @@ export default class ManyRelationship extends Relationship { return this._manyArray; } - destroy() { - super.destroy(); + removeInverseRelationships() { + super.removeInverseRelationships(); if (this._manyArray) { this._manyArray.destroy(); this._manyArray = null; diff --git a/addon/-private/system/relationships/state/relationship.js b/addon/-private/system/relationships/state/relationship.js index 582e2fa799a..0fea51f1ee4 100644 --- a/addon/-private/system/relationships/state/relationship.js +++ b/addon/-private/system/relationships/state/relationship.js @@ -85,7 +85,7 @@ export default class Relationship { return this.internalModel.modelName; } - destroy() { + removeInverseRelationships() { if (!this.inverseKey) { return; } let allMembers =