apotonick/roar-rails — pull request #93 by summera (2014-11-29 20:13:53+00:00)
Title: Page representer

This is a `PageRepresenter` based off @apotonick [blog post](http://nicksda.apotomo.de/2012/05/ruby-on-rest-6-pagination-with-roar/). It can be used with Kaminari or will_paginate to easily include pagination with your Decorator Representers.

```ruby
class VenuesRepresenter < Roar::Decorator
include Roar::Representer::JSON
include Roar::Representer::Feature::Hypermedia
include Roar::Rails::PageRepresenter

# The rest of your representer...
end
```

This can also be used with the `CollectionRepresenter` (https://github.com/apotonick/roar-rails/pull/92) to create a paginated representer

```ruby
class VenuesRepresenter < Roar::Decorator
include Roar::Representer::JSON
include Roar::Representer::Feature::Hypermedia
include Roar::Rails::CollectionRepresenter
include Roar::Rails::PageRepresenter
end
```

I updated the [README](https://github.com/summera/roar-rails/blob/734ba940032d9e4b1ba653cfe95f6c8c78956886/README.markdown#pagination-with-decorators) with an explanation.