Use `ctx.instance` provided by "after delete" hook

Use the recently added context property `ctx.instance` to improve
the accuracy of the algorithm detecting whether a single or
multiple models were deleted.
This commit is contained in:
Miroslav Bajtoš 2015-03-23 11:48:48 +01:00
parent 911d8323b4
commit cadb5e4524
1 changed files with 3 additions and 1 deletions

View File

@ -1362,7 +1362,9 @@ function rectifyOnSave(ctx, next) {
}
function rectifyOnDelete(ctx, next) {
var id = getIdFromWhereByModelId(ctx.Model, ctx.where);
var id = ctx.instance ? ctx.instance.getId() :
getIdFromWhereByModelId(ctx.Model, ctx.where);
if (id) {
ctx.Model.rectifyChange(id, reportErrorAndNext);
} else {