Class: Jsonapi::QueryBuilder::Paginator::Kaminari

Inherits:
BasePaginator
  • Object
show all
Defined in:
lib/jsonapi/query_builder/paginator/kaminari.rb

Instance Attribute Summary

Attributes inherited from BasePaginator

#collection

Instance Method Summary collapse

Methods inherited from BasePaginator

#initialize

Constructor Details

This class inherits a constructor from Jsonapi::QueryBuilder::Paginator::BasePaginator

Instance Method Details

#paginate(page_params) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/jsonapi/query_builder/paginator/kaminari.rb', line 9

def paginate(page_params)
  paged_collection = collection
    .page(page_params[:number])
    .per(page_params[:size])
    .padding(page_params[:offset])

  [paged_collection, pagination_details(paged_collection, page_params)]
end