Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: wrong column used in JOIN clause when querying a reverse association #450

Closed
wants to merge 1 commit into from

Conversation

carlosafonso
Copy link

(Fixes #446) When querying a reverse association, one of the two columns used in the generated 'JOIN...ON' clause was not the right one. One of the columns being used was the table's primary key, whereas the expected one was the foreign key.

…n the 'JOIN...ON' clause was not the right one (fixes dresende#446)
@vendethiel
Copy link

tests ;) ?

@dresende
Copy link
Owner

It looks OK, but it would be great to have a specific test case to avoid having that mistake again. It's very easy to be confused changing code in (reversed) associations.

@dxg dxg added this to the v2.1.4 milestone Feb 24, 2014
@dxg dxg closed this in ae7a562 Mar 13, 2014
@dxg
Copy link
Collaborator

dxg commented Mar 13, 2014

After writing a test, it turned out that not only did from need changing, but so did to.
It worked for you because of the peculiar naming of your id fields.

Anyways, it's fixed and in master! Hopefully going to release a new version in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reverse associations are not using the correct field in JOIN clause
4 participants