Merge pull request #101 from lforge/master

Fix for issue #72 beforeCreate trigger not firing properly
This commit is contained in:
Anatoliy Chakkaev 2012-07-11 05:22:09 -07:00
commit c1ce788253
1 changed files with 4 additions and 0 deletions

View File

@ -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);