X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/43db18ae911fef3ad7b36e9ed27e5eff469ef863..5058e7d748334f4d2c435d7818d7b55537739d1e:/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)