Back to Vault

Serializers & Adapters

ui/docs/serializers-adapters.md

2.0.01002 B
Original Source

Serializers & Adapters

Guidelines

  • Prepend internal functions with an underscore to differentiate from Ember methods _getUrl
  • Consider using the named-path adapter if the model name is part of the request path
  • Utilize the serializer to remove sending model attributes that do not correspond to an API parameter. Example in key serializer
js
export default class SomeSerializer extends ApplicationSerializer {
  attrs = {
    attrName: { serialize: false },
  };
}

Note: this will remove the attribute when calling snapshot.serialize() even if the method is called within the serialize method where custom logic may be written

Gotchas