Skip to content

Commit

Permalink
add paging helper method to array ext
Browse files Browse the repository at this point in the history
  • Loading branch information
teeaki committed Aug 27, 2012
1 parent b386c32 commit 641264b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/kaminari/models/array_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ def current_page_count #:nodoc:
def offset(num)
self.class.new @_original_array, :limit => @_limit_value, :offset => num, :total_count => @_total_count
end

def prev?
@_offset_value > 0
end

def next?
@_offset_value + @_limit_value > @_total_count
end
end

# Wrap an Array object to make it paginatable
Expand Down

0 comments on commit 641264b

Please sign in to comment.