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

ActiveRecord regression with Polymorphic joins + exists? #15821

Closed
lucasmazza opened this issue Jun 19, 2014 · 0 comments
Closed

ActiveRecord regression with Polymorphic joins + exists? #15821

lucasmazza opened this issue Jun 19, 2014 · 0 comments
Milestone

Comments

@lucasmazza
Copy link
Contributor

We have found a regression when trying out the master branch in our app over the last few weeks and haven't managed to fix it yet. Calling Relation#exists? while joining a polymorphic association is broken, as it looks like the binds for the query are wrong. This issue does not happens with 4.1.1/4.1.2.rc2.

Here is a script to reproduce the issue. The script also has tests for .count and .to_a with the same join, which are working as expected.

I tried to track and fix this one with @kassio and @laurocaetano but we didn't had any luck 🙈.

/cc @rafaelfranca @tenderlove

@rafaelfranca rafaelfranca added this to the 4.2.0 milestone Jun 19, 2014
@kassio kassio closed this as completed in 7aeca50 Aug 18, 2014
chancancode added a commit that referenced this issue Sep 5, 2014
This is cased by 03118bc + 9b5d603. The first commit referenced the undefined
local variable `column` when it should be using `reflection.type` as the lookup
key. The second commit changed `build_arel` to not modify the `bind_values` in-
place so we need to combine the arel's `bind_values` with the relation's when
building the SQL.

Fixes #16591

Related #15821 / #15892 / 7aeca50
trungpham pushed a commit to trungpham/rails that referenced this issue Sep 18, 2014
This is cased by 03118bc + 9b5d603. The first commit referenced the undefined
local variable `column` when it should be using `reflection.type` as the lookup
key. The second commit changed `build_arel` to not modify the `bind_values` in-
place so we need to combine the arel's `bind_values` with the relation's when
building the SQL.

Fixes rails#16591

Related rails#15821 / rails#15892 / 7aeca50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants