Fix HasOne PK on modelFrom instead of modelTo

This commit is contained in:
Pandaiolo 2014-10-17 15:44:24 +02:00
parent 0f0a9282b0
commit 9eaeb9e399
1 changed files with 2 additions and 2 deletions

View File

@ -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); });
}
};
};