Kaminari pagination, how to get the number of the current page?

I am using Kaminari to paginate some results from a db query.

I would like to apply specific styling to the first page of the results. The operation is very easy once I know on what page the user is, but I can't find a way to detect the current page.

Answers


If you want to check for first page you can do it like this:

 if object.first_page?
    #your logic here
 end

If you find the specific page you can do something like this:

current_page_no = object.current_page

For more info refer: http://rubydoc.info/github/amatsuda/kaminari/master/Kaminari/PageScopeMethods/InstanceMethods


Need Your Help

List all validation rules for a certain model

ruby-on-rails-3 validation model rspec ruby-on-rails-3.2

I think I have duplication in validation of an attribute since I am getting the same validation error twice on email field.

how to override the already overridden class

magento

Some other custom module has already overridden a third party module's class file(SOME BLOG EXTENSION). After researching I came to know that you can only override once.