Skip to content
Browse files

Update README.rdoc

clarify that paginate_array does not work on the array inline, but instead returns a new PaginatableArray.
  • Loading branch information...
1 parent 705d93a commit 769ae4910dd61acd616c2bb9d031ba9add7e971a @peashutop peashutop committed Feb 21, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 README.rdoc
4 README.rdoc
@@ -241,10 +241,10 @@ Kaminari includes a handy template generator.
Kaminari provides an Array wrapper class that adapts a generic Array object to the <tt>paginate</tt> view helper.
However, the <tt>paginate</tt> helper doesn't automatically handle your Array object (this is intentional and by design).
<tt>Kaminari::paginate_array</tt> method converts your Array object into a paginatable Array that accepts <tt>page</tt> method.
- Kaminari.paginate_array(my_array_object).page(params[:page]).per(10)
+ paginatable_array = Kaminari.paginate_array(my_array_object).page(params[:page]).per(10)
You can specify the +total_count+ value through options Hash. This would be helpful when handling an Array-ish object that has a different +count+ value from actual +count+ such as RSolr search result or when you need to generate a custom pagination. For example:
- Kaminari.paginate_array([], total_count: 145).page(params[:page]).per(10)
+ paginatable_array = Kaminari.paginate_array([], total_count: 145).page(params[:page]).per(10)
== Creating friendly URLs and caching

0 comments on commit 769ae49

Please sign in to comment.
Something went wrong with that request. Please try again.