Add proper type registration

This commit is contained in:
Anatoliy Chakkaev 2013-02-22 01:24:20 +07:00
parent 5a1df1b418
commit 35571dcd58
2 changed files with 12 additions and 6 deletions

View File

@ -231,7 +231,6 @@ function prepareContext(models, railway, app, defSchema, done) {
ctx[typeName] = Schema.types[typeName];
}
}
ctx.Text = Schema.Text;
return ctx;

View File

@ -19,6 +19,18 @@ exports.Schema = Schema;
*/
var slice = Array.prototype.slice;
Schema.Text = function Text() {};
Schema.JSON = function JSON() {};
Schema.types = {};
Schema.registerType = function (type) {
this.types[type.name] = type;
};
Schema.registerType(Schema.Text);
Schema.registerType(Schema.JSON);
/**
* Schema - adapter-specific classes factory.
*
@ -107,11 +119,6 @@ function Schema(name, settings) {
util.inherits(Schema, require('events').EventEmitter);
function Text() {}
Schema.Text = Text;
function JSON() {}
Schema.JSON = JSON;
/**
* Define class
*