Added fix to the abstract-class.js file for issue #72. The fix is resolved by by5739.

This commit is contained in:
Jude Lam 2012-07-08 21:20:11 -04:00
parent 7a2e300181
commit 913f9d4fc1
1 changed files with 4 additions and 0 deletions

View File

@ -197,6 +197,10 @@ AbstractClass.create = function (data, callback) {
function create() { function create() {
obj.trigger('create', function (done) { 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) { this._adapter().create(modelName, this.constructor._forDB(data), function (err, id) {
if (id) { if (id) {
defineReadonlyProp(obj, 'id', id); defineReadonlyProp(obj, 'id', id);