Fix conversion for `updateAttributes`

This commit is contained in:
Amir Jafarian 2016-02-02 18:27:55 -05:00
parent 96588622b8
commit dbdf915334
1 changed files with 3 additions and 3 deletions

View File

@ -58,11 +58,11 @@ function copyData(from, to) {
} }
} }
function convertDataPropertiesByType(data) { function convertSubsetOfPropertiesByType(inst, data) {
var typedData = {}; var typedData = {};
for (var key in data) { for (var key in data) {
// Convert the properties by type // Convert the properties by type
typedData[key] = data[key]; typedData[key] = inst[key];
if (typeof typedData[key] === 'object' if (typeof typedData[key] === 'object'
&& typedData[key] !== null && typedData[key] !== null
&& typeof typedData[key].toObject === 'function') { && typeof typedData[key].toObject === 'function') {
@ -2523,7 +2523,7 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, op
inst.trigger('save', function (saveDone) { inst.trigger('save', function (saveDone) {
inst.trigger('update', function (done) { inst.trigger('update', function (done) {
copyData(data, inst); copyData(data, inst);
var typedData = convertDataPropertiesByType(data); var typedData = convertSubsetOfPropertiesByType(inst, data);
context.data = typedData; context.data = typedData;
function updateAttributesCallback(err) { function updateAttributesCallback(err) {