You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using .joins() or .join_on() on a table with a predefined belongs_to_many relationship, the resulting query does not join on the pivot table.
To Reproduce
Add a belongs_to_many relationship on a model:
classOrganization(Model):
@belongs_to_many(local_foreign_key="organization_id",other_foreign_key="user_id",local_owner_key="organization_id",other_owner_key="id",table="organization_members",with_fields=["role"], )defmembers(self):
from .userimportUserreturnUser
Describe the bug
When using
.joins()
or.join_on()
on a table with a predefinedbelongs_to_many
relationship, the resulting query does not join on the pivot table.To Reproduce
belongs_to_many
relationship on a model:users
:Expected behavior
The resulting SQL should join to
users
through the defined relationship:Desktop (please complete the following information):
What database are you using?
Additional Context
The
clause
arg in the.joins()
method should change the second join type, since the pivot join should always beINNER
The text was updated successfully, but these errors were encountered: