diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /lib/unnested_in_filters | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'lib/unnested_in_filters')
-rw-r--r-- | lib/unnested_in_filters/rewriter.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/unnested_in_filters/rewriter.rb b/lib/unnested_in_filters/rewriter.rb index ed1e4ce2d9f..9eb1c0b8273 100644 --- a/lib/unnested_in_filters/rewriter.rb +++ b/lib/unnested_in_filters/rewriter.rb @@ -45,7 +45,7 @@ module UnnestedInFilters def serialized_array_values values.map(&:value) - .then { array_type.serialize(_1) } + .then { |value| array_type.serialize(value) } .then { |array| quote(array) } end @@ -58,7 +58,7 @@ module UnnestedInFilters end def column - columns.find { _1.name == attribute } + columns.find { |column| column.name == attribute } end def unprepared_statement_collector @@ -180,12 +180,12 @@ module UnnestedInFilters end def filter_query - model.from(from).then { add_relation_defaults(_1) } + model.from(from).then { |relation| add_relation_defaults(relation) } end def index_only_filter_query model.where(model.primary_key => filter_query.select(model.primary_key)) - .then { add_relation_defaults(_1) } + .then { |relation| add_relation_defaults(relation) } end def add_relation_defaults(new_relation) @@ -229,7 +229,9 @@ module UnnestedInFilters # Actively filter any nodes that don't belong to the primary queried table to prevent sql type resolution issues # Context: https://gitlab.com/gitlab-org/gitlab/-/issues/370271#note_1151019824 def arel_in_nodes - where_clause_arel_nodes.select(&method(:in_predicate?)).select { model_column_names.include?(_1.left.name) } + where_clause_arel_nodes + .select { |arel_node| in_predicate?(arel_node) } + .select { |arel_node| model_column_names.include?(arel_node.left.name) } end # `ActiveRecord::WhereClause#ast` is returning a single node when there is only one @@ -270,7 +272,7 @@ module UnnestedInFilters end def order_attributes - @order_attributes ||= order_values.flat_map(&method(:extract_column_name)) + @order_attributes ||= order_values.flat_map { |order_value| extract_column_name(order_value) } end def extract_column_name(order_value) |