Sha256: eda7b39b9eab3d85554e0e8b96cfb592e18d963b55e843386caf7c5764c5ee5e

Contents?: true

Size: 592 Bytes

Versions: 3

Compression:

Stored size: 592 Bytes

Contents

module MeiliSearch
  module Pagination
    autoload :WillPaginate, 'meilisearch/pagination/will_paginate'
    autoload :Kaminari, 'meilisearch/pagination/kaminari'

    def self.create(results, total_hits, options = {})
      return results if MeiliSearch.configuration[:pagination_backend].nil?

      begin
        backend = MeiliSearch.configuration[:pagination_backend].to_s.classify

        ::MeiliSearch::Pagination.const_get(backend).create(results, total_hits, options)
      rescue NameError
        raise(BadConfiguration, 'Unknown pagination backend')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
meilisearch-rails-0.4.1 lib/meilisearch/pagination.rb
meilisearch-rails-0.4.0 lib/meilisearch/pagination.rb
meilisearch-rails-0.3.0 lib/meilisearch/pagination.rb