Sha256: 362c56ae6b2ecfd177405d89ab73db9921eb053673431e353ecb2e0af7a13a1f
Contents?: true
Size: 432 Bytes
Versions: 16
Compression:
Stored size: 432 Bytes
Contents
module PaginationSearch module Pagination def paginate_with(attribute_locations) @paginated_records = PaginatedRecords.new(self, attribute_locations) end def paginated(base_relation, params) pagination_ids = @paginated_records.page_for(base_relation, params).map(&:id) where(id: pagination_ids).includes(self::INCLUDES_MODELS).sort_by { |item| pagination_ids.find_index(item.id) } end end end
Version data entries
16 entries across 16 versions & 1 rubygems