2014-06-20 06:29:49 +04:00
|
|
|
import ApplicationAdapter from 'ghost/adapters/application';
|
|
|
|
|
2015-08-19 14:55:40 +03:00
|
|
|
export default ApplicationAdapter.extend({
|
2015-10-28 14:36:45 +03:00
|
|
|
updateRecord(store, type, record) {
|
|
|
|
let data = {};
|
|
|
|
let serializer = store.serializerFor(type.modelName);
|
2014-06-20 06:29:49 +04:00
|
|
|
|
|
|
|
// remove the fake id that we added onto the model.
|
|
|
|
delete record.id;
|
|
|
|
|
|
|
|
// use the SettingSerializer to transform the model back into
|
|
|
|
// an array of settings objects like the API expects
|
|
|
|
serializer.serializeIntoHash(data, type, record);
|
|
|
|
|
|
|
|
// use the ApplicationAdapter's buildURL method but do not
|
|
|
|
// pass in an id.
|
2015-10-28 14:36:45 +03:00
|
|
|
return this.ajax(this.buildURL(type.modelName), 'PUT', {data});
|
2014-06-20 06:29:49 +04:00
|
|
|
}
|
|
|
|
});
|