Skip to content

Commit

Permalink
Move pagination into private method for overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie authored and pablobm committed Jul 21, 2022
1 parent c16c062 commit 599912c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/administrate/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def index
resources = filter_resources(scoped_resource, search_term: search_term)
resources = apply_collection_includes(resources)
resources = order.apply(resources)
resources = resources.page(params[:_page]).per(records_per_page)
resources = paginate_resources(resources)
page = Administrate::Page::Collection.new(dashboard, order: order)

render locals: {
Expand Down Expand Up @@ -239,5 +239,9 @@ def new_resource
def authorize_resource(resource)
resource
end

def paginate_resources(resources)
resources.page(params[:_page]).per(records_per_page)
end
end
end

0 comments on commit 599912c

Please sign in to comment.