method
visit_Arel_Nodes_In
v6.0.0 -
Show latest stable
- Class:
Arel::Visitors::ToSql
visit_Arel_Nodes_In(o, collector)private
No documentation available.
# File activerecord/lib/arel/visitors/to_sql.rb, line 516
def visit_Arel_Nodes_In(o, collector)
unless Array === o.right
return collect_in_clause(o.left, o.right, collector)
end
unless o.right.empty?
o.right.delete_if { |value| unboundable?(value) }
end
return collector << "1=0" if o.right.empty?
in_clause_length = @connection.in_clause_length
if !in_clause_length || o.right.length <= in_clause_length
collect_in_clause(o.left, o.right, collector)
else
collector << "("
o.right.each_slice(in_clause_length).each_with_index do |right, i|
collector << " OR " unless i == 0
collect_in_clause(o.left, right, collector)
end
collector << ")"
end
end