diff --git a/lib/waterline/core/transformations.js b/lib/waterline/core/transformations.js index 441ee771b..872c35ac9 100644 --- a/lib/waterline/core/transformations.js +++ b/lib/waterline/core/transformations.js @@ -58,7 +58,7 @@ Transformation.prototype.initialize = function(attributes, tables) { // Set transformation attr to new key if (key === 'columnName') { - if (attr === attributes[attr][key]) return; + // if (attr === attributes[attr][key]) return; // cjy37 del self._transformations[attr] = attributes[attr][key]; } @@ -103,8 +103,9 @@ Transformation.prototype.serialize = function(attributes, behavior) { // Schema must be serialized in first level only if (behavior === 'schema') { if (hasOwnProperty(self._transformations, property)) { - obj[self._transformations[property]] = _.clone(obj[property]); + var tmpval = _.clone(obj[property]); // cjy37 delete obj[property]; + obj[self._transformations[property]] = tmpval; // cjy37 } return; } @@ -117,8 +118,9 @@ Transformation.prototype.serialize = function(attributes, behavior) { // check if object key is in the transformations if (hasOwnProperty(self._transformations, property)) { - obj[self._transformations[property]] = _.clone(obj[property]); + var tmpval = _.clone(obj[property]); // cjy37 delete obj[property]; + obj[self._transformations[property]] = tmpval; // cjy37 return recursiveParse(obj[self._transformations[property]]); } @@ -129,8 +131,10 @@ Transformation.prototype.serialize = function(attributes, behavior) { // Check if property is a transformation key if (hasOwnProperty(self._transformations, property)) { - obj[self._transformations[property]] = obj[property]; + var tmpval = obj[property]; // cjy37 delete obj[property]; + obj[self._transformations[property]] = tmpval; // cjy37 + } }); } diff --git a/package.json b/package.json index c6c517719..8d01e830e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "waterline", "description": "An ORM for Node.js and the Sails framework.", - "version": "0.11.11", + "version": "0.11.12", "homepage": "http://waterlinejs.org", "contributors": [ {