Skip to content

Instantly share code, notes, and snippets.

@ruiramos
Last active November 5, 2015 14:22
Show Gist options
  • Save ruiramos/1687be7a7edaa14816ec to your computer and use it in GitHub Desktop.
Save ruiramos/1687be7a7edaa14816ec to your computer and use it in GitHub Desktop.
requestAction: function(action, method, options){
var unMapMethod = {
POST: 'create',
PUT: 'update',
DELETE: 'delete',
GET: 'read'
};
// calls ampersand sync
this.sync(unMapMethod[method], this, _.extend({
url: _.result(this, 'url') + '/' + action,
data: JSON.stringify({})
}, options));
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment