Merge pull request #221 from fabien/fix/updateAttributes

Handle toObject in updateAttributes
This commit is contained in:
Raymond Feng 2014-08-15 09:10:21 -07:00
commit 97306037e3
1 changed files with 4 additions and 0 deletions

View File

@ -1175,6 +1175,10 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, cb
// Convert the properties by type // Convert the properties by type
inst[key] = data[key]; inst[key] = data[key];
typedData[key] = inst[key]; typedData[key] = inst[key];
if (typeof typedData[key] === 'object'
&& typeof typedData[key].toObject === 'function') {
typedData[key] = typedData[key].toObject();
}
} }
inst._adapter().updateAttributes(model, getIdValue(inst.constructor, inst), inst._adapter().updateAttributes(model, getIdValue(inst.constructor, inst),