From 0a62bffafb8fc2ae2fcd75a3ce7a119f07dd65c0 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 20 Jun 2014 21:13:10 -0700 Subject: [PATCH 1/2] Fix updateAttributes impl See https://github.com/strongloop/loopback-connector-mysql/issues/40 --- lib/sql.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sql.js b/lib/sql.js index 0c6b349..d7dbc2b 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -334,13 +334,15 @@ SqlConnector.prototype.count = function count(model, callback, where) { * @param {Object} data The model data instance containing all properties to be updated * @param {Function} cb The callback function */ -SqlConnector.prototype.updateAttributes = function updateAttrs(model, id, data, cb) { +SqlConnector.prototype.updateAttributes = function updateAttributes(model, id, data, cb) { if (!isIdValuePresent(id, cb)) { return; } var idName = this.getDataSource(model).idName(model); - data[idName] = id; - this.save(model, data, cb); + delete data[idName]; + var where = {}; + where[idName] = id; + this.updateAll(model, where, data, cb); }; /** From 4913b868c512accea0a35ad7dcfe90d02093aa4e Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Sun, 20 Jul 2014 13:54:25 -0700 Subject: [PATCH 2/2] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 86ec551..30d99eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-connector", - "version": "1.1.0", + "version": "1.1.1", "description": "Building blocks for LoopBack connectors", "keywords": [ "StrongLoop",