From d8a1df8aa40aef3881a348c5296e3426078586d4 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 24 Jan 2022 00:45:45 +0900 Subject: [PATCH] Make sure that `without_count` works when chained after `where` refs #1077 --- .../active_record/paginable_without_count_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kaminari-core/test/models/active_record/paginable_without_count_test.rb b/kaminari-core/test/models/active_record/paginable_without_count_test.rb index 0e6dd01..44ec27f 100644 --- a/kaminari-core/test/models/active_record/paginable_without_count_test.rb +++ b/kaminari-core/test/models/active_record/paginable_without_count_test.rb @@ -70,6 +70,18 @@ if defined? ActiveRecord assert @users.out_of_range? end + test 'it works when chained after `where`' do + @scope = User.where.not(id: nil).page(1).without_count + @scope.each + + assert_no_queries do + assert_not @scope.last_page? + end + assert_no_queries do + assert_not @scope.out_of_range? + end + end + test 'regression: call arel first' do @users = User.page(1).without_count @users.arel