README.md in paginate-responder-1.3.0 vs README.md in paginate-responder-1.4.0
- old
+ new
@@ -1,7 +1,11 @@
-# Paginate::Responder [![Build Status](https://travis-ci.org/jgraichen/paginate-responder.png?branch=master)](https://travis-ci.org/jgraichen/paginate-responder) [![Code Climate](https://codeclimate.com/github/jgraichen/paginate-responder.png)](https://codeclimate.com/github/jgraichen/paginate-responder)
+# Paginate::Responder
+[![Gem Version](https://badge.fury.io/rb/paginate-responder.png)](http://badge.fury.io/rb/paginate-responder)
+[![Build Status](https://travis-ci.org/jgraichen/paginate-responder.png?branch=master)](https://travis-ci.org/jgraichen/paginate-responder)
+[![Code Climate](https://codeclimate.com/github/jgraichen/paginate-responder.png)](https://codeclimate.com/github/jgraichen/paginate-responder)
+
A Rails pagination responder with link header support.
## Installation
Add this line to your application's Gemfile:
@@ -18,11 +22,11 @@
You will also need a pagination gem. `PaginateResponder` comes with adapters for
* [will_paginate](https://github.com/mislav/will_paginate) and
* [kaminari](https://github.com/amatsuda/kaminari).
-It is recommended to use only on pagination gem at once.
+It is recommended to use only one pagination gem at once.
## Usage
Add `Responders::PaginateResponder` to your responder chain:
@@ -54,11 +58,40 @@
Next and previous page links will not be added if current
page is first or last page.
Also a `X-Total-Pages` header will be added with the total
-number of pages if available. This allows applications
+number of pages if available and a `X-Total-Count` header
+with the total number of items. This allows applications
to display a progress bar or similar while fetching pages.
+
+## Override page detections and options
+
+You can override the page detection by creating a method
+`page` in your controller that returns the page index as
+a fixnum:
+
+```
+class ApplicationController
+ def page
+ params[:seite].to_i # seite means page in German
+ end
+end
+```
+
+Same goes for `per_page` and `max_per_page`:
+
+```
+class ApplicationController
+ def per_page
+ 10
+ end
+
+ def max_per_page
+ 25
+ end
+end
+```
## TODOs
* Documentation
** Controller methods