Sha256: be7afa15462cbc309050d34df5c8b1a653b1d2b3d4619c13554b6637f74eaace
Contents?: true
Size: 638 Bytes
Versions: 3
Compression:
Stored size: 638 Bytes
Contents
begin require 'will_paginate/collection' rescue LoadError raise(MeiliSearch::BadConfiguration, "MeiliSearch: Please add 'will_paginate' to your Gemfile to use will_paginate pagination backend") end module MeiliSearch module Pagination class WillPaginate def self.create(results, total_hits, options = {}) ::WillPaginate::Collection.create(options[:page], options[:per_page], total_hits) do |pager| start = (options[:page] - 1) * options[:per_page] paginated_results = results[start, options[:per_page]] pager.replace paginated_results end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems