Embedded records on GET only

Using the EmbeddedRecordsMixin, I’ve create a serializer for a certain model and added embedded: 'always' for all its relationships. It works! When I send a GET request to the server, I receive all relations embedded in the payload and Ember Data knows how to deal with it.

But I only want the relation to be embedded in a GET payload, and not in the parameters of a POST or PUT request.

I’ve been looking in the documantation but I can’t find out how to solve this.

replace embedded:'always' with:

deserialize: 'records',
serialize: false

If you’re interested then this is the page you need for details on how this works - EmbeddedRecordsMixin - 4.6 - Ember API Documentation

1 Like