From 5b33c2a0f19fc40c5c3d94f81866f4d618f771cf Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Tue, 29 Jan 2013 18:47:03 +0700 Subject: [PATCH] Removed unused experimental stuff --- lib/abstract-class.js | 2 +- lib/schema.js | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/abstract-class.js b/lib/abstract-class.js index ae4918c5..2b9c63df 100644 --- a/lib/abstract-class.js +++ b/lib/abstract-class.js @@ -133,7 +133,7 @@ AbstractClass.whatTypeName = function (propName) { AbstractClass._forDB = function (data) { var res = {}; Object.keys(data).forEach(function (propName) { - if (this.whatTypeName(propName) === 'JSON' || data[propName] instanceof Array) { + if (this.whatTypeName(propName) === 'JSON') { res[propName] = JSON.stringify(data[propName]); } else { res[propName] = data[propName]; diff --git a/lib/schema.js b/lib/schema.js index 305aeaed..0ae4b735 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -242,6 +242,9 @@ Schema.prototype.define = function defineClass(className, properties, settings) return NewClass; + +}; + function standartize(properties, settings) { Object.keys(properties).forEach(function (key) { var v = properties[key]; @@ -257,9 +260,6 @@ Schema.prototype.define = function defineClass(className, properties, settings) // or {timestamps: {created: 'created_at', updated: false}} // by default property names: createdAt, updatedAt } - -}; - /** * Define single property named `prop` on `model` * @@ -300,11 +300,9 @@ Schema.prototype.defineProperty = function (model, prop, params) { */ Schema.prototype.extendModel = function (model, props) { var t = this; + standartize(props, {}); Object.keys(props).forEach(function (propName) { var definition = props[propName]; - if (typeof definition === 'function' || typeof definition !== 'object') { - definition = {type: definition}; - } t.defineProperty(model, propName, definition); }); };