Fix HasOne PK on modelFrom instead of modelTo
This commit is contained in:
parent
0f0a9282b0
commit
9eaeb9e399
|
@ -1417,7 +1417,7 @@ RelationDefinition.hasOne = function (modelFrom, modelTo, params) {
|
|||
params = params || {};
|
||||
modelTo = lookupModelTo(modelFrom, modelTo, params);
|
||||
|
||||
var pk = modelTo.dataSource.idName(modelTo.modelName) || 'id';
|
||||
var pk = modelFrom.dataSource.idName(modelFrom.modelName) || 'id';
|
||||
var relationName = params.as || i8n.camelize(modelTo.modelName, true);
|
||||
|
||||
var fk = params.foreignKey || i8n.camelize(modelFrom.modelName + '_id', true);
|
||||
|
@ -2748,4 +2748,4 @@ ReferencesMany.prototype.remove = function (acInst, cb) {
|
|||
} else {
|
||||
process.nextTick(function() { cb(null, ids); });
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue