Created
August 29, 2014 03:47
-
-
Save joepie91/82a7e75aad26c2c05f86 to your computer and use it in GitHub Desktop.
Bookshelf plugin for only committing changed attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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