Commit 58365ce030b3b2c78c185359cf873d9544f8564e

Authored by Andrew Kane
2 parents 72baec0e ed9374c5

Merge branch 'joe1chen-kaminari-out-of-range-fix'

Showing 2 changed files with 5 additions and 0 deletions   Show diff stats
lib/searchkick/results.rb
... ... @@ -131,6 +131,10 @@ module Searchkick
131 131 next_page.nil?
132 132 end
133 133  
  134 + def out_of_range?
  135 + current_page > total_pages
  136 + end
  137 +
134 138 def hits
135 139 @response["hits"]["hits"]
136 140 end
... ...
test/sql_test.rb
... ... @@ -40,6 +40,7 @@ class TestSql < Minitest::Test
40 40 assert !products.first_page?
41 41 assert !products.last_page?
42 42 assert !products.empty?
  43 + assert !products.out_of_range?
43 44 assert products.any?
44 45 end
45 46  
... ...