Skip to content

Instantly share code, notes, and snippets.

@amiel
Created August 6, 2014 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiel/a0e10f07c3076bbcc849 to your computer and use it in GitHub Desktop.
Save amiel/a0e10f07c3076bbcc849 to your computer and use it in GitHub Desktop.
Example serializer for supporting the lack of a root key
ApplicationSerializer = DS.RESTSerializer.extend
extract: (store, type, payload, id, requestType) ->
newPayload = {}
newPayload[type.typeKey] = payload
@_super store, type, newPayload, id, requestType
serializeIntoHash: (hash, type, record, options) ->
Ember.merge hash, @serialize record, options
ApplicationSerializer.reopenClass toString: -> 'ApplicationSerializer'
`export default ApplicationSerializer`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment