Fix inherit bug

This commit is contained in:
Ritchie Martori 2013-07-15 18:22:49 -07:00
parent 2de55df939
commit 0aa0cabdd4
1 changed files with 5 additions and 4 deletions

View File

@ -120,24 +120,25 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
}
};
// mix in EventEmitter
// mix in EventEmitter (dont inherit from)
var events = new EventEmitter();
ModelClass.on = events.on.bind(events);
ModelClass.once = events.once.bind(events);
ModelClass.emit = events.emit.bind(events);
ModelClass.setMaxListeners = events.setMaxListeners.bind(events);
hiddenProperty(ModelClass, 'schema', schema);
hiddenProperty(ModelClass, 'modelName', className);
hiddenProperty(ModelClass, 'pluralModelName', pluralName || i8n.pluralize(className));
hiddenProperty(ModelClass, 'relations', {});
// inherit ModelBaseClass methods
util.inherits(ModelClass, ModelBaseClass);
// inherit ModelBaseClass static methods
for (var i in ModelBaseClass) {
ModelClass[i] = ModelBaseClass[i];
}
util.inherits(ModelClass, ModelBaseClass);
ModelClass.getter = {};
ModelClass.setter = {};
standartize(properties, settings);