Changed validatable inheritance, fixed issue with belongsTo #113

This commit is contained in:
Anatoliy Chakkaev 2012-08-24 12:21:21 +04:00
parent 3faaa56450
commit e46716f9d2
1 changed files with 3 additions and 1 deletions

View File

@ -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 {