Module: Uchi::Pagination::Controller
- Includes:
- Pagy::Method
- Included in:
- RepositoryController
- Defined in:
- lib/uchi/pagination/controller.rb
Instance Method Summary collapse
-
#paginate(records, records_per_page:) ⇒ Array<(Uchi::Pagination::Page, ActiveRecord::Relation)>
Set up pagination for the given records.
Instance Method Details
#paginate(records, records_per_page:) ⇒ Array<(Uchi::Pagination::Page, ActiveRecord::Relation)>
Set up pagination for the given records. Returns a Page object and the paginated records for that page.
20 21 22 23 |
# File 'lib/uchi/pagination/controller.rb', line 20 def paginate(records, records_per_page:) page, records = pagy(:offset, records, limit: records_per_page) [Uchi::Pagination::Page.new(page), records] end |