The number of elements for a page in Kaminari is determined by:
- definition of the per_page element in the model or
- definition of default_per_page in config.
My question is how to get this number of elements in view?
Update
Excuse me for not knowing. What I want is to show the order of the elements on each page. I have a table title:
<th>
And a few columns below:
<td><%= (@sales.current_page - 1) * some_ruby_code + index + 1 %></td>
My question is: should some_ruby_code be?
1) If I replaced some_ruby_code with Sale.per_page , it will Sale.per_page error when I decided to remove per_page .
2) If I replace some_ruby_code with Kaminari.config.default_per_page , it will not show the correct value when I add per_page to the model.
I want to know if a method exists in Kaminari that detects the existence of per_page , returns its value if it exists, or Kaminari.config.default_per_page otherwise.
Thanks!
source share