Module: Pagination
- Defined in:
- lib/jbuilder/pagination.rb,
lib/jbuilder/pagination/exceptions/unpageable_resource_error.rb
Defined Under Namespace
Modules: Errors
Constant Summary collapse
- DEFAULT_PAGINATION =
The order of this hash matters, elements are pulled off the end by calling .pop recursively
[[:page, ->(params) { params.dig(:page, :number) }], [:per, ->(params) { params.dig(:page, :size) }]].freeze
Instance Method Summary collapse
Instance Method Details
#paginate(pageable_resource, methods = DEFAULT_PAGINATION.dup, params = self.params) ⇒ Object
10 11 12 13 14 |
# File 'lib/jbuilder/pagination.rb', line 10 def paginate(pageable_resource, methods = DEFAULT_PAGINATION.dup, params = self.params) return pageable_resource if methods.blank? key_value_array = methods.pop build_pagination(key_value_array, paginate(pageable_resource, methods, params), params) end |