-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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 an association with scope block failing #11963
Comments
I can confirm that it fails with 4.0.0, |
Indeed - weird! Confirmed for master and db: sqlite3, pg. Investigating... |
Oh, I forgot. Yes 4.0 stable and master. I also tested with mysql and fails too. |
In order to remove duplication with joining arel where constraints with `AND`, all constraints on `build_arel` are collapsed into one head node: `Arel::Nodes::And` Closes: rails#11963
In order to remove duplication with joining arel where constraints with `AND`, all constraints on `build_arel` are collapsed into one head node: `Arel::Nodes::And` Closes: rails#11963
Closed by #12011 |
So collapse_wheres, that was the place to fix it. I looked and couldn't figure out where the bug was happening...Thanks!! |
When defining a scope block for associations fails in some cases.
The problem isn't when getting the association but when joining by it, and it depends on how the association scope is defined.
I included 4 test cases. 2 of them work, and 2 of them fail.
In the cases that fail, the conditions aren't joined with an AND but with a comma.
Here's the gist with the tests:
https://gist.github.com/iwiznia/6295952
The text was updated successfully, but these errors were encountered: