Skip to content

Instantly share code, notes, and snippets.

@alistair
Created May 18, 2015 21:53
Show Gist options
  • Select an option

  • Save alistair/626b9a28bf06eaa4646d to your computer and use it in GitHub Desktop.

Select an option

Save alistair/626b9a28bf06eaa4646d to your computer and use it in GitHub Desktop.
Backbone post update convention
// http_conventions.js
var Backbone = require('Backbone');
var postOnUpdate = function(method, model, options) {
return Backbone.sync('create', model, options);
}
var postOnGet = // whatever here
export.postOnUpdate = postOnUpdate;
export.postOnGet = postOnGet;
// whatever other conventions you need.
// Question.js
var Conventions = require('http_conventions');
export = Backbone.Model.extend({
sync: Conventions.postOnUpdate,
.....
.....
.....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment