Skip to content

Commit

Permalink
Fixed condition under which onCreating hook is triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed May 26, 2015
1 parent 1385f89 commit 6e59fe7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ModelHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ModelHandlers<TDocument extends { _id?: any }, TInstance> {
creatingDocuments(documents: TDocument[]): Bluebird<any[]> {
return Bluebird.all(documents.map((document: any) => {
return Bluebird.resolve().then(() => {
if (this.model.hooks.onRetrieved) this.model.hooks.onCreating(document);
if (this.model.hooks.onCreating) this.model.hooks.onCreating(document);
var validation: Skmatc.Result = this.model.helpers.validate(document);
if (validation.failed) return Bluebird.reject(validation.error);
return document;
Expand Down

0 comments on commit 6e59fe7

Please sign in to comment.