Commit 3433375dd9125320d1bf68e1ec554fe207f74711

Authored by Andrew Kane
1 parent 1418ccac

Added offset for #139

Showing 2 changed files with 2 additions and 0 deletions   Show diff stats
lib/searchkick/results.rb
@@ -85,6 +85,7 @@ module Searchkick @@ -85,6 +85,7 @@ module Searchkick
85 def offset_value 85 def offset_value
86 current_page * per_page 86 current_page * per_page
87 end 87 end
  88 + alias_method :offset, :offset_value
88 89
89 def previous_page 90 def previous_page
90 current_page > 1 ? (current_page - 1) : nil 91 current_page > 1 ? (current_page - 1) : nil
test/sql_test.rb
@@ -29,6 +29,7 @@ class TestSql < Minitest::Unit::TestCase @@ -29,6 +29,7 @@ class TestSql < Minitest::Unit::TestCase
29 assert_equal 5, products.total_entries 29 assert_equal 5, products.total_entries
30 assert_equal 2, products.limit_value 30 assert_equal 2, products.limit_value
31 assert_equal 4, products.offset_value 31 assert_equal 4, products.offset_value
  32 + assert_equal 4, products.offset
32 assert !products.first_page? 33 assert !products.first_page?
33 assert !products.last_page? 34 assert !products.last_page?
34 end 35 end