Support string types when defining properties

This commit is contained in:
Ritchie 2013-06-17 16:42:13 -07:00
parent d442c40f25
commit 502b0512d3
1 changed files with 3 additions and 0 deletions

View File

@ -191,6 +191,8 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
DataType = function Text(s) {
return s;
};
} else if(typeof DataType === 'string') {
DataType = getSchemaType(DataType);
}
Object.defineProperty(ModelClass.prototype, attr, {
@ -211,6 +213,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
if (value === null || value === undefined) {
this.__data[attr] = value;
} else {
console.log(attr, value);
this.__data[attr] = DataType(value);
}
}