diff --git a/lib/dao.js b/lib/dao.js index 4062d24f..50a0c273 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -363,7 +363,7 @@ DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data var isOriginalQuery = isWhereByGivenId(Model, ctx.query.where, id) if (Model.getDataSource().connector.updateOrCreate && isOriginalQuery) { - var context = { + var context = { Model: Model, where: ctx.query.where, data: data, @@ -1530,7 +1530,7 @@ DataAccessObject.prototype.save = function (options, cb) { var inst = this; var modelName = Model.modelName; var hookState = {}; - + var context = { Model: Model, instance: inst, hookState: hookState }; Model.notifyObserversOf('before save', context, function(err) { if (err) return cb(err); @@ -1737,7 +1737,7 @@ DataAccessObject.prototype.remove = var id = getIdValue(this.constructor, this); var hookState = {}; - var context = { + var context = { Model: Model, query: byIdQuery(Model, id), hookState: hookState }; @@ -1897,7 +1897,7 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, op var Model = this.constructor; var model = Model.modelName; var hookState = {}; - + // Convert the data to be plain object so that update won't be confused if (data instanceof Model) { data = data.toObject(false);