diff --git a/lib/abstract-class.js b/lib/abstract-class.js index aa958c5b..491b5793 100644 --- a/lib/abstract-class.js +++ b/lib/abstract-class.js @@ -9,7 +9,8 @@ var DEFAULT_CACHE_LIMIT = 1000; exports.AbstractClass = AbstractClass; -jutil.inherits(AbstractClass, Validatable); +AbstractClass.__proto__ = Validatable; +AbstractClass.prototype.__proto__ = Validatable.prototype; jutil.inherits(AbstractClass, Hookable); /** @@ -739,6 +740,7 @@ AbstractClass.belongsTo = function (anotherClass, params) { this.prototype['__finders__'][methodName] = function (id, cb) { anotherClass.find(id, function (err,inst) { if (err) return cb(err); + if (!inst) return cb(null, null); if (inst[fk] === this.id) { cb(null, inst); } else {