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

Version Path
aleph_analytics-0.4.9.pre.dev lib/pagination_search/pagination.rb
aleph_analytics-0.4.8 lib/pagination_search/pagination.rb
aleph_analytics-0.4.7 lib/pagination_search/pagination.rb
aleph_analytics-0.4.4 lib/pagination_search/pagination.rb
aleph_analytics-0.4.2 lib/pagination_search/pagination.rb
aleph_analytics-0.4.1 lib/pagination_search/pagination.rb
aleph_analytics-0.3.0 lib/pagination_search/pagination.rb
aleph_analytics-0.2.0 lib/pagination_search/pagination.rb
aleph_analytics-0.1.0 lib/pagination_search/pagination.rb
aleph_analytics-0.0.6 lib/pagination_search/pagination.rb
aleph_analytics-0.0.5 lib/pagination_search/pagination.rb
aleph_analytics-0.0.4 lib/pagination_search/pagination.rb
aleph_analytics-0.0.3 lib/pagination_search/pagination.rb
aleph_analytics-0.0.2 lib/pagination_search/pagination.rb
aleph_analytics-0.0.1.alpha lib/pagination_search/pagination.rb
aleph_analytics-0.0.0.alpha lib/pagination_search/pagination.rb