Skip to content

Commit

Permalink
[BUGFIX beta] Use Ember.guidFor to set InternalModel's guid.
Browse files Browse the repository at this point in the history
In future versions of Ember, the `Ember.GUID_KEY` property may not be the place that guids are stored per object (may be moving to a `WeakMap`).  This change keeps `this[GUID_KEY]` around for easier debugging (though it isn't _required_ per-se), and uses `Ember.guidFor` to get the guid and setup the object.
  • Loading branch information
rwjblue authored Sep 29, 2016
1 parent cdbdcfd commit d914eb0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions addon/-private/system/model/internal-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function retrieveFromCurrentState(key) {
};
}

var guid = 0;
/*
`InternalModel` is the Model class that we use internally inside Ember Data to represent models.
Internal ED methods should only deal with `InternalModel` objects. It is a fast, plain Javascript class.
Expand Down Expand Up @@ -81,7 +80,7 @@ export default function InternalModel(type, id, store, _, data) {
this.isError = false;
this.error = null;
this.__ember_meta__ = null;
this[Ember.GUID_KEY] = guid++ + 'internal-model';
this[Ember.GUID_KEY] = Ember.guidFor(this);
/*
implicit relationships are relationship which have not been declared but the inverse side exists on
another record somewhere
Expand Down

0 comments on commit d914eb0

Please sign in to comment.