From 913f9d4fc168cc3c5fae0ee4a394b64b75fe8529 Mon Sep 17 00:00:00 2001 From: Jude Lam Date: Sun, 8 Jul 2012 21:20:11 -0400 Subject: [PATCH] Added fix to the abstract-class.js file for issue #72. The fix is resolved by by5739. --- lib/abstract-class.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/abstract-class.js b/lib/abstract-class.js index bf540321..d27ad3c0 100644 --- a/lib/abstract-class.js +++ b/lib/abstract-class.js @@ -197,6 +197,10 @@ AbstractClass.create = function (data, callback) { function create() { obj.trigger('create', function (done) { + + var data = this.toObject(true); // Added this to fix the beforeCreate trigger not fire. + // The fix is per issue #72 and the fix was found by by5739. + this._adapter().create(modelName, this.constructor._forDB(data), function (err, id) { if (id) { defineReadonlyProp(obj, 'id', id);