diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-10-24 12:53:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-24 12:53:37 -0400 |
commit | d3e646595fb33fce131750fb558b72560afdeb3f (patch) | |
tree | b6f28545d3783b8a12b906261d9470965aba45c0 /activerecord/lib/active_record/connection_adapters | |
parent | eba2ba8d3aacba1e91b521754f988345c1d780c5 (diff) | |
parent | ce40073c9c321575e6b4f46dd5ac9b796a2637be (diff) | |
download | rails-d3e646595fb33fce131750fb558b72560afdeb3f.tar.gz rails-d3e646595fb33fce131750fb558b72560afdeb3f.tar.bz2 rails-d3e646595fb33fce131750fb558b72560afdeb3f.zip |
Merge pull request #34303 from kamipo/lazy_checking_boundable
Lazy checking whether or not values in IN clause are boundable
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb b/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb index 3dcb916d99..f158946c6d 100644 --- a/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +++ b/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb @@ -10,8 +10,17 @@ module ActiveRecord super end - def visit_Arel_Nodes_In(*) + def visit_Arel_Nodes_In(o, collector) @preparable = false + + if Array === o.right && !o.right.empty? + o.right.delete_if do |bind| + if Arel::Nodes::BindParam === bind && Relation::QueryAttribute === bind.value + !bind.value.boundable? + end + end + end + super end |