Skip to content

Commit

Permalink
Merge branch 'master' of github1602:1602/jugglingdb
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Apr 11, 2013
2 parents f4bf02a + 81ad2a6 commit 9cb7051
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions README.md
Expand Up @@ -238,8 +238,8 @@ The following callbacks supported:
- afterUpdate
- beforeDestroy
- afterDestroy
- beforeValidation
- afterValidation
- beforeValidate
- afterValidate

Each callback is class method of the model, it should accept single argument: `next`, this is callback which
should be called after end of the hook. Except `afterInitialize` because this method is syncronous (called after `new Model`).
Expand All @@ -249,19 +249,21 @@ should be called after end of the hook. Except `afterInitialize` because this me
```javascript
var user = new User;
// afterInitialize
user.save(callback);
// beforeValidation
// afterValidation
user.save(callback); // If Model.id isn't set, save will invoke Model.create() instead
// beforeValidate
// afterValidate
// beforeSave
// beforeCreate
// afterCreate
// beforeUpdate
// afterUpdate
// afterSave
// callback
user.updateAttribute('email', 'email@example.com', callback);
// beforeValidate
// afterValidate
// beforeSave
// beforeUpdate
// beforeValidation
// afterValidation
// afterUpdate
// afterSave
// callback
user.destroy(callback);
// beforeDestroy
Expand All @@ -271,6 +273,8 @@ User.create(data, callback);
// beforeValidate
// afterValidate
// beforeCreate
// beforeSave
// afterSave
// afterCreate
// callback
```
Expand Down

0 comments on commit 9cb7051

Please sign in to comment.