updateAttributes data defaults to {}

This commit is contained in:
Sascha Gehlich 2012-12-19 19:29:14 +01:00
parent ceff4278e8
commit 7ec8ab55d1
1 changed files with 2 additions and 0 deletions

View File

@ -721,6 +721,8 @@ AbstractClass.prototype.updateAttributes = function updateAttributes(data, cb) {
var inst = this; var inst = this;
var model = this.constructor.modelName; var model = this.constructor.modelName;
if(!data) data = {};
// update instance's properties // update instance's properties
Object.keys(data).forEach(function (key) { Object.keys(data).forEach(function (key) {
inst[key] = data[key]; inst[key] = data[key];