class WillPaginate::Collection

The key to pagination

Arrays returned from paginating finds are, in fact, instances of this little class. You may think of WillPaginate::Collection as an ordinary array with some extra properties. Those properties are used by view helpers to generate correct page links.

WillPaginate::Collection also assists in rolling out your own pagination solutions: see create.

If you are writing a library that provides a collection which you would like to conform to this API, you don’t have to copy these methods over; simply make your plugin/gem dependant on this library and do:

require 'will_paginate/collection'
# WillPaginate::Collection is now available for use