Skip to content

Commit

Permalink
fix: modelName undefined when serializing fragment and fragment array (
Browse files Browse the repository at this point in the history
…#407)

* fix: modelName undefined when serializing fragment

Resolves #406

* fix: alternative model name for fragment array
  • Loading branch information
knownasilya authored Oct 7, 2021
1 parent d8e57eb commit 4f77b2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addon/transforms/fragment-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const FragmentArrayTransform = FragmentTransform.extend({
let store = this.store;

return snapshots.map(snapshot => {
let serializer = store.serializerFor(snapshot.modelName);
let serializer = store.serializerFor(snapshot.modelName || snapshot.constructor.modelName);
return serializer.serialize(snapshot);
});
}
Expand Down
2 changes: 1 addition & 1 deletion addon/transforms/fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const FragmentTransform = Transform.extend({
}

let store = this.store;
let serializer = store.serializerFor(snapshot.modelName);
let serializer = store.serializerFor(snapshot.modelName || snapshot.constructor.modelName);

return serializer.serialize(snapshot);
},
Expand Down

0 comments on commit 4f77b2d

Please sign in to comment.