Last Update: 2021-09-21 14:24:30 -0700

The pagination extension adds the Sequel::Dataset#paginate and each_page methods, which return paginated (limited and offset) datasets with the following methods added that make creating a paginated display easier:

  • page_size

  • page_count

  • page_range

  • current_page

  • next_page

  • prev_page

  • first_page?

  • last_page?

  • pagination_record_count

  • current_page_record_count

  • current_page_record_range

This extension uses Object#extend at runtime, which can hurt performance.

You can load this extension into specific datasets:

ds = DB[:table]
ds = ds.extension(:pagination)

Or you can load it into all of a database’s datasets, which is probably the desired behavior if you are using this extension:


Related modules: Sequel::DatasetPagination, Sequel::Dataset::Pagination