X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6290405336817cd282ad5062ce3fc3774ccf61e4..28886a1ba3d217375e63f58519bd7f67e89ba0f4:/app/controllers/concerns/pagination_methods.rb?ds=sidebyside diff --git a/app/controllers/concerns/pagination_methods.rb b/app/controllers/concerns/pagination_methods.rb index 3dc9f52aa..79ab10bfb 100644 --- a/app/controllers/concerns/pagination_methods.rb +++ b/app/controllers/concerns/pagination_methods.rb @@ -6,6 +6,9 @@ module PaginationMethods ## # limit selected items to one page, get ids of first item before/after the page def get_page_items(items, includes: [], limit: 20) + param! :before, Integer, :min => 1 + param! :after, Integer, :min => 1 + id_column = "#{items.table_name}.id" page_items = if params[:before] items.where("#{id_column} < ?", params[:before]).order(:id => :desc)