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
Joining more than 3 tables in a row and merging scopes crashes #15488
Comments
It is related to #15461: you found another place (in As for - relation.joins! rest
+ relation.joins! *rest I will also fix that in #15461. |
JOIN clauses order is important, previous implementation always put string or arel joins at then end (after auto-generated association joins). Fixes rails#12953, rails#15488.
JOIN clauses order is important, previous implementation always put string or arel joins at then end (after auto-generated association joins). Fixes rails#12953, rails#15488, rails#16635.
This issue has been automatically marked as stale because it has not been commented on for at least The resources of the Rails team are limited, and so we are asking for your help. If you can still reproduce this error on the Thank you for all your contributions. |
As seen in attached gist, I have created 5 tables, connected by belongs_to one to one relationships.
Joining 3 of them in order works fine, joining the 4th one yields an incorrect sql query, where the table join order is wrong, and joining 4 of them raises an ActiveRecord::ConfigurationError
I initially thought it is related to #15461 but I tried the patch and it does not solve this issue, so it might be a separate problem.
The text was updated successfully, but these errors were encountered: