Friday, October 26

Kaminari - Pagination gem for Rails3

Going down the line of Rails history, I was one of those people who admired the in-built pagination feature of Rails. Then later on as we progressed to Rails2 this was plugged out and that's when will_paginate got popularized as both gem and plug-in. It became part of every application that I had built of course varying with different CSS, styles. With advent of Rails3 and unsupported will_paginate had pushed us to move on with alternatives... here come Kaminari

So straight away, jumping on to the point it's pagination gem supporting Rails3. Kaminari is based on Scope & Engine (like rails engine!). It is simple, powerful

  1. Scope based API
  2. I18n customizable helper
  3. ORM & Template engine supported
  4. Supports HTML5
  5. Flavored with themes

There are quite number of themes, recipes available for Kaminari. For users coming from will_paginate there are two striking difference to be noted in implementation

Considering we are paginating over the list of posts....

@posts = Post.paginate(:page => params[:page], :per_page => 10)
@posts =[:page]).per(10)

On to the views...

will_paginate @posts
paginate @posts

Kaminari -
Recipes -