Sha256: 41ee5aef843910efed3644d80765af6c035ade500219f757fe11f6b8aa92f0cd
Contents?: true
Size: 631 Bytes
Versions: 5
Compression:
Stored size: 631 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
5 entries across 5 versions & 1 rubygems