Skip to content

Commit

Permalink
Merge pull request #359 from wuron/master
Browse files Browse the repository at this point in the history
Fix deprecation: `ember-data:deprecate-snapshot-model-class-access`.
  • Loading branch information
fsmanuel authored Sep 4, 2022
2 parents 65c7d73 + 5fcd3b2 commit 77e4587
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions addon/serializers/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export default JSONAPISerializer.extend({
if (belongsTo === null || belongsToIsNotNew) {
json.relationships = json.relationships || {};

let payloadKey = this._getMappedKey(key, snapshot.type);
let modelType = this.store.modelFor(snapshot.modelName);
let payloadKey = this._getMappedKey(key, modelType);
if (payloadKey === key) {
payloadKey = this.keyForRelationship(key, 'belongsTo', 'serialize');
}
Expand Down Expand Up @@ -67,7 +68,8 @@ export default JSONAPISerializer.extend({
if (hasMany !== undefined) {
json.relationships = json.relationships || {};

let payloadKey = this._getMappedKey(key, snapshot.type);
let modelType = this.store.modelFor(snapshot.modelName);
let payloadKey = this._getMappedKey(key, modelType);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, 'hasMany', 'serialize');
}
Expand Down

0 comments on commit 77e4587

Please sign in to comment.