I have to send the requests to "http:http://ift.tt/1ShMJiU gallery_id is varying and I am getting it from params.id. Now the problem I am facing is that the response from a server is an array of objects.So what should I use?By That, I meant (findAll or findRecord).When I use FindRecord it make the correct call But is not able to serialize the data.When I use findAll it calls the wrong API.
My Serializer
import DS from 'ember-data';
export default DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin,{
isNewSerializerAPI: true,
primaryKey:'pk',
normalize: function(typeClass, hash) {
console.log(hash)
var fields = Ember.get(typeClass, 'fields');
fields.forEach(function(field) {
var payloadField = Ember.String.underscore(field);
if (field === payloadField) { return; }
hash[field] = hash[payloadField];
delete hash[payloadField];
});
return this._super.apply(this, arguments);
}
});
This is the error I am getting is
Assertion Failed: You must include an 'id' for gallery in an object passed to 'push'
Aucun commentaire:
Enregistrer un commentaire