From e2a9fc9995ba31af22a6e65dc6324121dcdab706 Mon Sep 17 00:00:00 2001 From: mhupman Date: Mon, 8 Apr 2013 12:20:46 -0300 Subject: [PATCH] Update README.md --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ed996bf4..f6b8eb6f 100644 --- a/README.md +++ b/README.md @@ -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`). @@ -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 @@ -271,6 +273,8 @@ User.create(data, callback); // beforeValidate // afterValidate // beforeCreate +// beforeSave +// afterSave // afterCreate // callback ```