Handle toObject in updateAttributes
Since one can call updateAttributes with any kind of properties (as opposed to save, which uses toObject internally), any objects that correspond to toObject should be handled as such. This is particularly the case with List objects, as used by embedsMany.
This commit is contained in:
parent
6ea6f19752
commit
7cd880712b
|
@ -1175,6 +1175,10 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, cb
|
|||
// Convert the properties by type
|
||||
inst[key] = data[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),
|
||||
|
|
Loading…
Reference in New Issue