Module: PaginationSearch::Pagination
Instance Method Summary collapse
Instance Method Details
#paginate_with(attribute_locations) ⇒ Object
3 4 5 |
# 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) ⇒ Object
7 8 9 10 |
# 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 |