From 5d858b5d3e5539ede0ea541a8e14126a3ee30800 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 24 Apr 2019 06:30:59 +0900 Subject: Fix sliced IN clauses to be grouped Follow up of #35838. And also this refactors `in_clause_length` handling is entirely integrated in Arel visitor. --- activerecord/test/cases/relation/where_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/cases/relation') diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index 2ecccfe1f3..6c1e3e7fec 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -20,6 +20,13 @@ module ActiveRecord class WhereTest < ActiveRecord::TestCase fixtures :posts, :edges, :authors, :author_addresses, :binaries, :essays, :cars, :treasures, :price_estimates, :topics + def test_in_clause_is_correctly_sliced + assert_called(Author.connection, :in_clause_length, returns: 1) do + david = authors(:david) + assert_equal [david], Author.where(name: "David", id: [1, 2]) + end + end + def test_where_copies_bind_params author = authors(:david) posts = author.posts.where("posts.id != 1") -- cgit v1.2.3