1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Fixes the inconsistency in the #first_page method

This commit is contained in:
Yuki Nishijima 2019-04-12 13:02:02 -04:00
parent c7d19fa403
commit 9d46d6029c
2 changed files with 7 additions and 1 deletions

View file

@ -75,7 +75,7 @@ module Kaminari
# First page of the collection? # First page of the collection?
def first_page? def first_page?
current_page == 1 !out_of_range? && (current_page == 1)
end end
# Last page of the collection? # Last page of the collection?

View file

@ -340,6 +340,12 @@ if defined? ActiveRecord
test 'not on first page' do test 'not on first page' do
assert_false model_class.page(5).per(10).first_page? assert_false model_class.page(5).per(10).first_page?
end end
test 'on first page with no record' do
model_class.delete_all
assert_false model_class.page(1).first_page?
end
end end
sub_test_case '#last_page?' do sub_test_case '#last_page?' do