Conversation
The left outer joins block in build_join_buckets only handled Arel::Nodes::OuterJoin, raising ArgumentError for other Join subclasses like InnerJoin. This occurs when filter_on callbacks produce Arel join sources that end up in left_outer_joins_values and pass through select_association_list. Broaden the check to Arel::Nodes::Join, matching the pattern already used in the joins_values block below. Also resolve Proc joins in build_filter_joins (#25). When filter_on specifies a lambda as dependent_joins, the Proc was pushed raw into relations instead of being called first. Now the Proc is called with the filter value to resolve the actual joins before classifying them. Also update CI matrix to drop Rails 7.1 (EOL) and bump 8.1.1 to 8.1.2.
2f189f7 to
7f09e83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two related issues when
filter_onuses non-standard join types:1.
build_join_bucketsonly handlesOuterJoinin the left outer joins blockThe override raises
ArgumentError: "only Hash, Symbol and Array are allowed"whenleft_outer_joins_valuescontains anArel::Nodes::Joinsubclass other thanOuterJoin(e.g.InnerJoin). These nodes flow throughselect_named_joins→select_association_list, which yields anything that is not a Hash/Symbol/Array/JoinDependency to the block. The block only handledCTEJoinandOuterJoin.2. Proc joins from
filter_onnot resolved inbuild_filter_joins(fixes #25)When
filter_onis called with a lambda asdependent_joins:The Proc was pushed raw into
relationsinbuild_filter_joins, then sent toleft_outer_joins!infilter!, whereselect_association_listcannot handle it.Fix
query_methods_extension.rb: Broadened theelsiffromArel::Nodes::OuterJointoArel::Nodes::Join, matching the pattern already used in thejoins_valuesblock below.predicate_builder_extension.rb: AddedProchandling inbuild_filter_joins— whenjsis a Proc, call it with the filter value to resolve the actual joins before classifying them asrelationsorcustom.Other changes
filter_onwith Arel join nodes and Proc joins