-
-
Notifications
You must be signed in to change notification settings - Fork 809
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
AR 5.2.1 and 5.2.2 transitive polymorphic association results in INNER JOIN which breaks "or" searches #996
Comments
@gregmolnar Is anyone actively looking into this or #955 ? (sorry for the dup) Also the separate, but related #902 These are show-stopper bugs for Rails 5.2.1+, polymorphic relationship searches are broken |
@dholdren I am struggling with time recently and as far as I know others are not looking into this either. If all goes well, I should be able to look into it this weekend/early next week. |
@gregmolnar Yes it looks good. LEFT OUTER joins, and they now have the polymorphic constraint. thanks! |
Problem
When searching a model's polymorphic association's association's field in Rails 5.2 ransack generates a
INNER JOIN
which causesor
type searches to break(i.e. a Note's notable Article's comment's body)
Working combination: Rails 5.0, ransack 2.1.1 (latest):
This generates
LEFT OUTER JOIN
s for everythingBroken combination Rails 5.2.2 (also 5.2.1), ransack 2.1.1 (latest)
This generates an
INNER JOIN
for thecomments
table so it ignores any other tables we chose to searchAdditional bug
You can see in the Rails 5.2.2 example, that the polymorphic associations
LEFT OUTER JOIN
aren't limited bynotable_type
. This causes other issues. This was reported in #902The text was updated successfully, but these errors were encountered: