File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
lib/core_extensions/active_record/relation Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,27 @@ def reverse_order!
1212 self
1313 end
1414
15+ def build_with_value_from_hash ( hash )
16+ return super if ::ActiveRecord ::version >= Gem ::Version . new ( '7.2' )
17+
18+ # Redefine for ActiveRecord < 7.2
19+ hash . map do |name , value |
20+ expression =
21+ case value
22+ when ::Arel ::Nodes ::SqlLiteral then ::Arel ::Nodes ::Grouping . new ( value )
23+ when ::ActiveRecord ::Relation then value . arel
24+ when ::Arel ::SelectManager then value
25+ when Symbol then value
26+ else
27+ raise ArgumentError , "Unsupported argument type: `#{ value } ` #{ value . class } "
28+ end
29+ ::Arel ::Nodes ::TableAlias . new ( expression , name )
30+ end
31+ end
32+
1533 def build_with_expression_from_value ( value , nested = false )
1634 case value
17- when Symbol
18- value
35+ when Symbol then value
1936 else
2037 super
2138 end
You can’t perform that action at this time.
0 commit comments