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
Don't ignore joins from association scopes in preloader #12538
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,6 +400,9 @@ def joins(*args) | |
end | ||
|
||
def joins!(*args) # :nodoc: | ||
args.reject!(&:blank?) | ||
args.flatten! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change needed for this PR. I think this should be extracted to separated PR. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, when there was no join conditions ( I could've put this check in associations/preloader/association.rb#build_scope instead with something like:
(or something cleaner, perhaps modifying There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for clarification, agree to leave this as is. |
||
|
||
self.joins_values += args | ||
self | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to either splat
*
the argument or changejoins!
in query_methods.rb to not use+=