-
Notifications
You must be signed in to change notification settings - Fork 369
Closed
Labels
Description
i define a status for a person:
Person.hasOne('status', Status, {
autoFetch: true
});i can set and change that status, but i cannot remove it:
person.removeStatus(callback);i add beforeSave and afterSave hooks to the Person Model:
hooks: {
beforeSave: function(next) {
console.log('beforeStatus', this.status_id);
next();
},
afterSave: function() {
console.log('afterStatus', this.status_id);
}
}it seems like the hooks are called 3 times (???)
beforeSave the first time tells me the expected value (this.status_id = null)
but before afterSave is called, beforeSave is called another 2 times having the original value of status_id... after those 3 beforeSave calls, the 3 afterSave calls are called, each of them having the original value of status_id in it, and not my expected value null
help?
Reactions are currently unavailable