POST Only Specific Model Properties



Using Ember Data to create a new record, I see that it’s serializing all the declared fields on my model. Normally, this is fine and desirable, but there are cases where I want to be able to control what is serialized and sent.

Is it possible to override the serialization behavior and if so, where might I start?

I am using the default ActiveModelSerializer

Thanks for any help.


Saving record, only certain attributes

Answering my own question here.

What I ended up doing was creating a specific serializer for the model that I need more control over.

So, if my model were a Post, I would have this:

App.PostSerializer = DS.ActiveModelSerializer.extend
  serialize: (post, options) ->
    json =
      content_id: post.get("content_id")
    if options.includeId? = post.get("id")

Hope this helps someone in the future.