Merge pull request #21 from strongloop/juggler-tidyup
Make sure foreign key properties are fully registered
This commit is contained in:
commit
a617f3dace
|
@ -1256,7 +1256,8 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key
|
|||
if (this.connector.defineForeignKey) {
|
||||
var cb = function (err, keyType) {
|
||||
if (err) throw err;
|
||||
this.definitions[className].defineProperty(key, {type: keyType});
|
||||
// Add the foreign key property to the data source _models
|
||||
this.defineProperty(className, key, {type: keyType || Number});
|
||||
}.bind(this);
|
||||
switch (this.connector.defineForeignKey.length) {
|
||||
case 4:
|
||||
|
@ -1268,10 +1269,10 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
this.definitions[className].defineProperty(key, {type: Number});
|
||||
// Add the foreign key property to the data source _models
|
||||
this.defineProperty(className, key, {type: Number});
|
||||
}
|
||||
|
||||
this.models[className].registerProperty(key);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue