Hi,
I have a simple ember model called Tag, I have the model as follows:
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
notes: DS.hasMany('note')
});
My RESTSerializer for this model is as follows:
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
payload = {
tags: payload
};
return this._super(store, primaryModelClass, payload, id, requestType);
},
serializeIntoHash: function(hash, type, record, options) {
Ember.merge(hash, this.serialize(record, options));
}
});
when trying to create a new tag, my server gives errors in this format: 400 Bad request { “error”: “test error message” }
However, Ember seems to be expecting errors in some other format. Something like
{"errors":[ ] }
How can I override my serializer to expect error payload in the format specified by my server?