Move pagination_params
into API::BaseController
(#28845)
This commit is contained in:
parent
a0b525e50b
commit
85d9053b36
28 changed files with 9 additions and 125 deletions
|
@ -3,6 +3,8 @@
|
|||
module Api::Pagination
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
PAGINATION_PARAMS = %i(limit).freeze
|
||||
|
||||
protected
|
||||
|
||||
def pagination_max_id
|
||||
|
@ -24,6 +26,13 @@ module Api::Pagination
|
|||
render json: { error: 'Pagination values for `offset` and `limit` must be positive' }, status: 400 if pagination_options_invalid?
|
||||
end
|
||||
|
||||
def pagination_params(core_params)
|
||||
params
|
||||
.slice(*PAGINATION_PARAMS)
|
||||
.permit(*PAGINATION_PARAMS)
|
||||
.merge(core_params)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def insert_pagination_headers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue