diff --git a/lib/model-builder.js b/lib/model-builder.js index 9ab831ad..07d7c838 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -154,7 +154,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett var events = new EventEmitter(); for (var f in EventEmitter.prototype) { if (typeof EventEmitter.prototype[f] === 'function') { - ModelClass[f] = events[f].bind(events); + ModelClass[f] = EventEmitter.prototype[f].bind(events); } } util.inherits(ModelClass, ModelBaseClass); @@ -178,9 +178,10 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett // inherit ModelBaseClass static methods for (var i in ModelBaseClass) { - if(i !== '_mixins') { - ModelClass[i] = ModelBaseClass[i]; - } + // We need to skip properties that are already in the subclass, for example, the event emitter methods + if(i !== '_mixins' && !(i in ModelClass)) { + ModelClass[i] = ModelBaseClass[i]; + } } ModelClass.getter = {};