Skip to content

Commit

Permalink
remove more unneeded class reification
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Feb 23, 2017
1 parent 47e3b86 commit 4bb9053
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions addon/-private/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ export function assertPolymorphicType(parentInternalModel, relationshipMeta, add
let addedModelName = addedInternalModel.modelName;
let parentModelName = parentInternalModel.modelName;
let key = relationshipMeta.key;
let relationshipClass = parentInternalModel.store.modelFor(relationshipMeta.type);
let assertionMessage = `You cannot add a record of modelClass '${addedModelName}' to the '${parentModelName}.${key}' relationship (only '${relationshipClass.modelName}' allowed)`;
let relationshipModelName = relationshipMeta.type;
let relationshipClass = parentInternalModel.store.modelFor(relationshipModelName);
let assertionMessage = `You cannot add a record of modelClass '${addedModelName}' to the '${parentModelName}.${key}' relationship (only '${relationshipModelName}' allowed)`;

assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass));
}
4 changes: 2 additions & 2 deletions addon/-private/system/relationships/state/relationship.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ export default class Relationship {

updateLink(link) {
heimdall.increment(updateLink);
warn(`You pushed a record of type '${this.record.type.modelName}' with a relationship '${this.key}' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload.`, this.isAsync || this.hasData , {
warn(`You pushed a record of type '${this.record.modelName}' with a relationship '${this.key}' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload.`, this.isAsync || this.hasData , {
id: 'ds.store.push-link-for-sync-relationship'
});
assert("You have pushed a record of type '" + this.record.type.modelName + "' with '" + this.key + "' as a link, but the value of that link is not a string.", typeof link === 'string' || link === null);
assert("You have pushed a record of type '" + this.record.modelName + "' with '" + this.key + "' as a link, but the value of that link is not a string.", typeof link === 'string' || link === null);

this.link = link;
this.linkPromise = null;
Expand Down

0 comments on commit 4bb9053

Please sign in to comment.