// Can also define static methods and properties
WhateverModel.someStaticMethod = function () {
// Do some other stuff
};
--
The official community discussion group.
website: geddyjs.org, source: https://github.com/mde/geddy, group: https://groups.google.com/d/forum/geddyjs?hl=en
---
You received this message because you are subscribed to the Google Groups "GeddyJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geddyjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
var custom = require("./custom");
var Todo = function(){
this.property('id','string');
this.property('domain','string');
}
Todo = custom.registerCustomModel('Todo',todo);_createStaticMethodsMixin = function (name) {
var obj = {};
obj.CustomAll = function (callback) {
// You need the name to access the model or the adapter
var model = geddy.model[name]
, adapter = geddy.model.adapters[name];
model.all({customquery},function(err,data){
if(err){callback(err,null); }
else{ callback(null,data);}
});
};
};
utils.mixin(ModelCtor, _createStaticMethodsMixin(name));
registerCustomModel = function registerCustomModel (name, ModelDefinition) {
var ModelCtor = geddy.model.register(name, ModelDefinition);
var obj = {};
obj.customStaticMethod = function () {
var model = geddy.model[name]
, adapter = geddy.model.adapters[name];
};
utils.mixin(ModelCtor, obj);
};
geddy.model.MODELNAME.customStaticMethod();
User.isAdmin=function(){
if (authType===('local account')) return 'LOCAL';
else return 'NOT';
}<%= user.isAdmin %>