Skip to content

Instantly share code, notes, and snippets.

@meatcar
Created May 15, 2013 17:07
Show Gist options
  • Save meatcar/5585550 to your computer and use it in GitHub Desktop.
Save meatcar/5585550 to your computer and use it in GitHub Desktop.
define([
"backbone",
"lodash"],
function(Backbone, _) {
var oldSync = Backbone.sync;
var methodMap = {
'create': 'POST',
'update': 'PATCH', // must use patch because put acts like post ATM
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
};
Backbone.sync = function(method, model, options){
if (method === 'update') {
method = 'patch';
}
oldSync.apply(this, arguments);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment