How to obtain per_page number of a Model in views?
kaminari, ruby-on-rails
Solution
You can use `Sale.default_per_page`.
See https://github.com/kaminari/kaminari/blob/1-0-stable/kaminari-core/lib/kaminari/models/configuration_methods.rb#L16
Problem
The number of items for a page in Kaminari is defined by: - defining per_page member in model, or - defining default_per_page in config. My question is, how to obtain that number of items in view? Update Pardon me for being not clear. What I want is to show is the order of item in each page. I have a table header: ``` <th>#</th> ``` And several columns below: ``` <td><%= (@sales.current_page - 1) * some_ruby_code + index + 1 %></td> ``` My question is what `some_ruby_code` should be? 1) If I substitute `some_ruby_code` with `Sale.per_page`, it will throw error when I decided to delete `per_page`. 2) If I substitute `some_ruby_code` with `Kaminari.config.default_per_page`, it won't show the proper value when I add `per_page` in model. I want to know whether there are a method in Kaminari which detects the existence of `per_page`, return its value if exists, or `Kaminari.config.default_per_page` otherwise. Thank you!