Changed validatable inheritance, fixed issue with belongsTo #113
This commit is contained in:
parent
3faaa56450
commit
e46716f9d2
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue