-
-
Notifications
You must be signed in to change notification settings - Fork 808
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
Rails 5.2.1: Join type for nested relation becomes INNER, not LEFT OUTER #955
Comments
I find it hard to say anything for certain, BUT this appears to certainly be a bug. In our case we're doing a
As you can see the INNER JOIN between applications and instructions is wrong and should be a LEFT OUTER JOIN as it was in Rails 5.2.0. |
it looks like with AR 5.2.1 and |
A PR with some failing tests would be super-helpful on this one. |
This seems to help: master...back2war:fix/rails-522 We'll battle test on prod tomorrow :) |
@varyform How was your test? Do you plan to create a PR in this repository? |
I'm updating an app from Rails 4 to 5.2.x, thus requiring an update to Ransack 2.x. I can confirm @varyform's linked branch does seem to fix issues with improper joins (cleaning up about 40 failures) via that app's test suite. |
Hi guys, It seems there is a fix for this issue. Do you plan to release it in near future? |
Anyone who had this issue, could you please verify that this PR fixes it? #1004 |
@gregmolnar I thank for your great work. Failed specs caused by join type in our app have passed with updated Rails 5.2.2 by using your branch. I also confirmed that a search query will match to nested attribute via On the other hand, a simple SQL query seems to have broken join type by patching. e.g. AR's class Foo < ApplicationRecord
has_one :bar
end
class Bar < ApplicationRecord
belongs_to :foo
end
|
@yhatt thanks! I will look into it. It looks like our specs have some issues:
That |
Sorry for the delay in responding. I've tested updated PR again the all of failed tests in my app have passed as like as Rails <= 5.2.0. It seems to be fixed the wrong join type too. Thanks for your excellent work against so deep problem! |
This one is resolved now I think. |
I have tried to upgrade own Rails from 5.2.0 to 5.2.1, but several tests using ransack query to nested relation have failed because of a join type difference.
A simple example to reproduce:
In Rails 5.2.1 and Ransack 2.0.1, the search query for
B
's name will never match ifC
was not related to any records fromB
.I don't know which one is the correct query on Rails 5.2.1, but it is sure that is losing compatible with the previous version.
The text was updated successfully, but these errors were encountered: