module PaginationSearch::Pagination

Public Instance Methods

paginate_with(attribute_locations) click to toggle source
# File lib/pagination_search/pagination.rb, line 3
def paginate_with(attribute_locations)
  @paginated_records = PaginatedRecords.new(self, attribute_locations)
end
paginated(base_relation, params) click to toggle source
# File lib/pagination_search/pagination.rb, line 7
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