Skip to content

Commit

Permalink
gets tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Dec 9, 2016
1 parent 434ba3c commit f22850a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions addon/-private/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ Store = Service.extend({
let keys = Object.keys(this._schemas);
keys.forEach(this.unloadAll, this);
} else {
let schema = this._schemas[modelName];
let schema = this._schemas[modelName] || this._schemas[guidFor(this.modelFor(modelName))];

if (schema) {
let recordMap = schema.recordMap;
Expand Down Expand Up @@ -1984,25 +1984,28 @@ Store = Service.extend({
if (this._schemas === null) {
this._schemas = new EmptyObject();
}
if (!this._schemas[modelName]) {
let modelClass = this.modelFor(modelName);
this._schemas[modelName] = new Schema(modelClass, this);

let modelClass = this.modelFor(modelName);
let schemaKey = guidFor(modelClass);

if (!this._schemas[schemaKey]) {
this._schemas[schemaKey] = new Schema(modelClass, this);
}

return this._schemas[modelName];
return this._schemas[schemaKey];
},

_schemaForModelClass(modelClass) {
let modelName = modelClass.modelName;
let schemaKey = guidFor(modelClass);

if (this._schemas === null) {
this._schemas = new EmptyObject();
}
if (!this._schemas[modelName]) {
this._schemas[modelName] = new Schema(modelClass, this);
if (!this._schemas[schemaKey]) {
this._schemas[schemaKey] = new Schema(modelClass, this);
}

return this._schemas[modelName];
return this._schemas[schemaKey];
},

// ................
Expand Down

0 comments on commit f22850a

Please sign in to comment.