Skip to content

Commit

Permalink
Merge pull request #4374 from dnachev/fix-embedded-records-serialize
Browse files Browse the repository at this point in the history
Fix #4366: EmbeddedRecordsMixin embeds the record, not the snapshot
  • Loading branch information
pangratz committed May 10, 2016
2 parents 2001ee3 + 91454da commit afeb5e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/serializers/embedded-records-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default Ember.Mixin.create({
if (!embeddedSnapshot) {
json[serializedKey] = null;
} else {
json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
json[serializedKey] = embeddedSnapshot.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);

if (relationship.options.polymorphic) {
Expand Down Expand Up @@ -440,7 +440,7 @@ export default Ember.Mixin.create({

for (let i = 0; i < manyArray.length; i++) {
let embeddedSnapshot = manyArray[i];
let embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
let embeddedJson = embeddedSnapshot.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
ret[i] = embeddedJson;
}
Expand Down

0 comments on commit afeb5e0

Please sign in to comment.