Skip to content

Instantly share code, notes, and snippets.

@joepie91
Created August 29, 2014 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepie91/82a7e75aad26c2c05f86 to your computer and use it in GitHub Desktop.
Save joepie91/82a7e75aad26c2c05f86 to your computer and use it in GitHub Desktop.
Bookshelf plugin for only committing changed attributes
module.exports = function(bookshelf) {
return bookshelf.Model.prototype.saveChanges = function(options) {
if (options == null) {
options = {};
}
options.patch = true;
return this.save(this.changed, options);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment