Module: ROM::SQL::Plugin::Pagination
- Defined in:
- lib/rom/sql/plugin/pagination.rb
Overview
Pagination plugin for Relations
Defined Under Namespace
Classes: Pager
Instance Method Summary collapse
-
#page(num) ⇒ Relation
Paginate a relation.
-
#per_page(num) ⇒ Relation
Set limit for pagination.
Instance Method Details
#page(num) ⇒ Relation
Paginate a relation
133 134 135 136 |
# File 'lib/rom/sql/plugin/pagination.rb', line 133 def page(num) next_pager = pager.at(dataset, num) new(next_pager.dataset, pager: next_pager) end |
#per_page(num) ⇒ Relation
Set limit for pagination
146 147 148 149 |
# File 'lib/rom/sql/plugin/pagination.rb', line 146 def per_page(num) next_pager = pager.at(dataset, pager.current_page, num) new(next_pager.dataset, pager: next_pager) end |