Skip to content

Commit

Permalink
feat(multilang): add serializers for localized models
Browse files Browse the repository at this point in the history
  • Loading branch information
velrest committed Jun 30, 2020
1 parent ec20d27 commit 88c89c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addon/serializers/localized.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import JSONAPISerializer from "@ember-data/serializer/json-api";

export default class ScopeSerializer extends JSONAPISerializer {
serializeAttribute(snapshot, json, key, attributes) {
super.serializeAttribute(snapshot, json, key, attributes);
if (snapshot.record.localizedFields.includes(key)) {
json.attributes[key] = snapshot.record.getUnlocalizedField(key);
}
}
}
1 change: 1 addition & 0 deletions app/serializers/localized.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "ember-emeis/serializers/localized";

0 comments on commit 88c89c5

Please sign in to comment.