aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/visitors/to_sql.rb2
-rw-r--r--test/visitors/test_to_sql.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 84a88e1899..2d81022a7a 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -500,7 +500,7 @@ module Arel
end
def visit_Arel_Nodes_And o
- o.children.map { |x| visit x}.join ' AND '
+ o.children.flatten.map { |x| visit x}.join ' AND '
end
def visit_Arel_Nodes_Or o
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index b142ecd695..0a7af91397 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -237,9 +237,9 @@ module Arel
end
it "should visit_Arel_Nodes_And" do
- node = Nodes::And.new [@attr.eq(10), @attr.eq(11)]
+ node = Nodes::And.new [@attr.eq(10), [@attr.eq(11), @attr.eq(12)]]
@visitor.accept(node).must_be_like %{
- "users"."id" = 10 AND "users"."id" = 11
+ "users"."id" = 10 AND "users"."id" = 11 AND "users"."id" = 12
}
end