From 502b0512d3c539d31261733fc02e0628382498ad Mon Sep 17 00:00:00 2001 From: Ritchie Date: Mon, 17 Jun 2013 16:42:13 -0700 Subject: [PATCH] Support string types when defining properties --- lib/model-builder.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/model-builder.js b/lib/model-builder.js index 295b119d..77badeb7 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -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); } }