Skip to content

Commit cdc3356

Browse files
charliedxg
authored andcommitted
Bugfix: when querying a reverse association, one of the two columns in the 'JOIN...ON' clause was not the right one (fixes dresende#446)
1 parent ba1dea5 commit cdc3356

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Associations/One.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ exports.prepare = function (Model, associations, association_properties, model_f
9494
}
9595

9696
options.__merge = {
97-
from : { table: association.model.table, field: association.model.id },
97+
from : { table: association.model.table, field: association.reversed ? Object.keys(association.field) : association.model.id },
9898
to : { table: Model.table, field: Object.keys(association.field) },
9999
where : [ association.model.table, conditions ],
100100
table : Model.table

0 commit comments

Comments
 (0)