From 0aa0cabdd475db6085bf7924375a7d03396d6d1e Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Mon, 15 Jul 2013 18:22:49 -0700 Subject: [PATCH] Fix inherit bug --- lib/model-builder.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/model-builder.js b/lib/model-builder.js index c622e45e..8b3beb91 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -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', {}); + + util.inherits(ModelClass, ModelBaseClass); - // inherit ModelBaseClass methods + // inherit ModelBaseClass static methods for (var i in ModelBaseClass) { ModelClass[i] = ModelBaseClass[i]; } - util.inherits(ModelClass, ModelBaseClass); - ModelClass.getter = {}; ModelClass.setter = {}; standartize(properties, settings);