user3379893
user3379893

Reputation: 193

Ember serializer override normalizeResponse

When I do

import DS from 'ember-data';
import Ember from 'ember';

export default DS.JSONAPISerializer.extend({
  normalizeResponse: function(modelName???){
    model = modelName;
    }
  });

Do I have access to the current model's name in normalizeResponse()? I get a hash of my data, but it doesn't provide me with the model name I so dearly need to create an acceptable ember-data object with a root-element in the json.

Upvotes: 0

Views: 636

Answers (1)

Jon
Jon

Reputation: 1234

I believe the full signature is:

normalizeResponse: function(store, primaryModelClass, payload, id, requestType, isSignle) {
    // ...
}

primaryModelClass is a string that represents your model class name.

Upvotes: 3

Related Questions