blob: f5692c95276b473fe36f0be45f82e95038e33fbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
# frozen_string_literal: true
module PaginatorExtension
# This method loads the records for the requested page and returns a keyset paginator object.
def keyset_paginate(cursor: nil, per_page: 20, keyset_order_options: {})
Gitlab::Pagination::Keyset::Paginator.new(scope: self.dup, cursor: cursor, per_page: per_page, keyset_order_options: keyset_order_options)
end
end
ActiveSupport.on_load(:active_record) do
ActiveRecord::Relation.include(PaginatorExtension)
end
|