<img src=“https://codeclimate.com/github/mattways/pageable.png” /> <img src=“https://secure.travis-ci.org/mattways/pageable.png?branch=master” alt=“Build Status” /> <img src=“https://gemnasium.com/mattways/pageable.png” alt=“Dependency Status” />
Pageable
Inspired in kaminari and will_paginate but more minimalistic.
Install
Put this line in your Gemfile:
gem 'pageable'
Then bundle:
$ bundle
Usage
The same approach as kaminari:
@records = Model.page(1).per(20)
And then just:
pager @records
Configuration
Default parameter and navigation
If you want to change the default parameter name or the default navigation length call pager:
pager @records, navigation: 3, parameter: :p
Or to set it globally put this in your application.rb:
config.pagination.default_parameter = :p
config.pagination. = 3
Default per page
If you want to change the default per_page put this in your model:
default_per_page 5
Or to set it globally put this in your application.rb:
config.pagination.default_per_page = 5
Padding
You can use positive and negative padding:
Model.page(1).per(10).padding(-4)