Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:1602/express-on-railway into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
1602 committed Oct 31, 2011
2 parents 18b39bc + 477ef9a commit d33a539
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/models.js
Expand Up @@ -41,7 +41,7 @@ function prepareContext(exportModels, defSchema) {
ctx.describe = ctx.define = function (className, callback) {
cname = className;
models[cname] = {};
callback();
callback && callback();
return ctx[cname] = exportModels[cname] = (schema || defSchema).define(className, models[cname]);
};

Expand All @@ -50,7 +50,11 @@ function prepareContext(exportModels, defSchema) {
*/
ctx.property = function (name, type, params) {
if (!params) params = {};
params.type = type;
if (typeof type !== 'function' && typeof type === 'object') {
params = type;
type = String;
}
params.type = type || String;
models[cname][name] = params;
};

Expand Down

0 comments on commit d33a539

Please sign in to comment.