From cddb24ec84c691f2df140bb8d03fa3fa97c4d023 Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Wed, 23 Jan 2013 07:51:07 +0700 Subject: [PATCH 1/4] 0.2.0-16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 59afc7a4..d1c9d3b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jugglingdb", "description": "ORM for every database: redis, mysql, neo4j, mongodb, couchdb, postgres, sqlite", - "version": "0.2.0-15", + "version": "0.2.0-16", "author": "Anatoliy Chakkaev ", "contributors": [ { From 5b33c2a0f19fc40c5c3d94f81866f4d618f771cf Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Tue, 29 Jan 2013 18:47:03 +0700 Subject: [PATCH 2/4] 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); }); }; From 9f0dfeb58af7b6da3543f42a4d0643b351b0c277 Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Wed, 30 Jan 2013 22:30:31 +0700 Subject: [PATCH 3/4] Add attr param to custom validator, closes #200 --- lib/validatable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validatable.js b/lib/validatable.js index ddccbb29..94d87651 100644 --- a/lib/validatable.js +++ b/lib/validatable.js @@ -245,7 +245,7 @@ function validateFormat(attr, conf, err) { * Custom validator */ function validateCustom(attr, conf, err, done) { - conf.customValidator.call(this, err, done); + conf.customValidator.call(this, err, attr, done); } /** From ae60569b9d79640510e33f7486623bc773b1a58c Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Wed, 30 Jan 2013 22:30:56 +0700 Subject: [PATCH 4/4] 0.2.0-17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d1c9d3b8..50bd12e0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jugglingdb", "description": "ORM for every database: redis, mysql, neo4j, mongodb, couchdb, postgres, sqlite", - "version": "0.2.0-16", + "version": "0.2.0-17", "author": "Anatoliy Chakkaev ", "contributors": [ {