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({
|
2014-06-20 06:29:49 +04:00
|
|
|
updateRecord: function (store, type, record) {
|
|
|
|
var data = {},
|
2015-06-03 05:56:42 +03:00
|
|
|
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-06-03 05:56:42 +03:00
|
|
|
return this.ajax(this.buildURL(type.modelName), 'PUT', {data: data});
|
2014-06-20 06:29:49 +04:00
|
|
|
}
|
|
|
|
});
|