• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

davidcelis / api-pagination / 45 / 2
99%
master: 99%

Build:
DEFAULT BRANCH: master
Ran 10 Apr 2014 09:53PM UTC
Files 11
Run time 2s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Apr 2014 09:33PM UTC coverage: 97.357% (+1.7%) from 95.631%
1.9.3, PAGINATOR=will_paginate

push

travis-ci

davidcelis
Change interface for Rails pagination

This fixes #7 but is also related to a more dire issue. `after_filter`
was misunderstood to provide access to the response before the body had
been written. In actuality, the response has already been fully
constructed by the time `after_filter` is called, which means that the
collection has already been queried and written as json (or XML). In
order to maintain a nice interface without using after_filter, the
method signature of `paginate` has changed to act like `render`:

```rails
class API::v1::PostsController < ApplicationController
  def index
    # Uncomment this line to change the default per_page from 10 to 25:
    # params[:per_page] ||= 25
    posts = Post.all

    paginate json: posts
  end
end
```

At the end, `paginate` simply passes its arguments on to `render` so all
of `render's` options are supported. The collection is assumed to live
either in the argument hash's `:json` key or an `:xml` key.

Signed-off-by: David Celis <me@davidcel.is>

221 of 227 relevant lines covered (97.36%)

7.58 hits per line

Source Files on job 45.2 (1.9.3, PAGINATOR=will_paginate)
  • Tree
  • List 0
  • Changed 11
  • Source Changed 10
  • Coverage Changed 10
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 45
  • Travis Job 45.2
  • 81ec7027 on github
  • Prev Job for 1.9.3, PAGINATOR=will_paginate on master (#44.2)
  • Next Job for 1.9.3, PAGINATOR=will_paginate on master (#46.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc