diff --git a/lib/patch/all.rb b/lib/patch/all.rb index 402523be..832b1871 100644 --- a/lib/patch/all.rb +++ b/lib/patch/all.rb @@ -2,5 +2,6 @@ require 'patch/active_record/queue' require 'patch/active_record/connection_pool' - require 'patch/active_record/interval_style' + +require 'patch/arel/bind_params' diff --git a/lib/patch/arel/bind_params.rb b/lib/patch/arel/bind_params.rb new file mode 100644 index 00000000..41ef0492 --- /dev/null +++ b/lib/patch/arel/bind_params.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Patch + # https://github.com/rails/arel/pull/499 + module BindParam + # rubocop:disable MethodName + def visit_Arel_SelectManager(o, collector) + collector << '(' + visit(o.ast, collector) << ')' + end + # rubocop:enable all + end + + ::Arel::Visitors::ToSql.prepend BindParam +end