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.


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

 if object.first_page?
    #your logic here

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

Find position of prime number

c algorithm math primes sieve

I need to do the reverse of finding the Nth prime, i.e. Given a prime number, I need to find its position in

Checking if arbitrary enumerable has any items in without generics

c# wpf windows-runtime ivalueconverter

So normally if you want to simply check if an IEnumerable<T> has any items in you'd use .Any() instead of .count > 0 - especially when you're hitting things like LINQ-To-Entities and .coun...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.