diff --git a/lib/persisted-model.js b/lib/persisted-model.js index 417953a1..ebf057d0 100644 --- a/lib/persisted-model.js +++ b/lib/persisted-model.js @@ -1425,8 +1425,12 @@ module.exports = function(registry) { }; function rectifyOnSave(ctx, next) { - if (ctx.instance) { - ctx.Model.rectifyChange(ctx.instance.getId(), reportErrorAndNext); + var instance = ctx.instance || ctx.currentInstance; + var id = instance ? instance.getId() : + getIdFromWhereByModelId(ctx.Model, ctx.where); + + if (id) { + ctx.Model.rectifyChange(id, reportErrorAndNext); } else { ctx.Model.rectifyAllChanges(reportErrorAndNext); }