Fix the fix

It turns out that in some situations it actually is only the id instead of object (nested queries).
This commit is contained in:
Jakub Skořepa 2018-08-08 00:05:33 +02:00 committed by GitHub
parent 3645cc15f4
commit b7edcffff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -630,7 +630,8 @@ module.exports = {
};
if (association.type === 'model') {
params.id = obj[association.alias].id;
const rel = obj[association.alias];
params.id = typeof rel === 'object' && 'id' in rel ? rel.id : rel;
} else {
// Get refering model.
const ref = association.plugin ?