Skip to content

Instantly share code, notes, and snippets.

@davelester
Created March 12, 2013 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davelester/5140329 to your computer and use it in GitHub Desktop.
Save davelester/5140329 to your computer and use it in GitHub Desktop.
diff --git a/models/badge.js b/models/badge.js
index 01c2eeb..8b9e4ff 100644
--- a/models/badge.js
+++ b/models/badge.js
@@ -21,6 +21,10 @@ Badge.prototype.presave = function () {
}
};
+Badge.prototype.postsave = function() {
+
+};
+
Badge.confirmRecipient = function confirmRecipient(assertion, email) {
// can't validate if not given an assertion
if (!assertion)
diff --git a/models/mysql-base.js b/models/mysql-base.js
index 7108715..de132e7 100644
--- a/models/mysql-base.js
+++ b/models/mysql-base.js
@@ -102,6 +102,9 @@ Base.prototype.save = function save(callback) {
this.presave();
client._upsert(table, attributes, parseResult.bind(this));
+
+ if ('function' === typeof this.presave)
+ this.postsave();
};
Base.prototype.destroy = function (callback) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment