Skip to content

Commit

Permalink
Added extract polymorphic for hasMany relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
Parrryy committed Oct 4, 2018
1 parent 46a3add commit 224400a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addon/serializers/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,17 @@ const JSONSerializer = Serializer.extend({
}
relationship = { data };
}

let linkKey = this.keyForLink(key, relationshipMeta.kind);
if (resourceHash.links && resourceHash.links[linkKey] !== undefined) {
let related = resourceHash.links[linkKey];
relationship = relationship || {};
relationship.links = { related };
}

if (relationship) {
relationships[key] = relationship;
}
});

return relationships;
Expand Down

0 comments on commit 224400a

Please sign in to comment.