Sha256: 9047ec229506ee3e88e8149acac681645d5c5740fb6f149f627ce3e8e949cdb9
Contents?: true
Size: 689 Bytes
Versions: 27
Compression:
Stored size: 689 Bytes
Contents
module Highrise module Pagination def self.included(base) base.extend(ClassMethods) end module ClassMethods def find_all_across_pages(options = {}) records = [] each(options) { |record| records << record } records end def each(options = {}) options[:params] ||= {} options[:params][:n] = 0 loop do if (records = self.find(:all, options)).any? records.each { |record| yield record } options[:params][:n] += records.size else break # no people included on that page, thus no more people total end end end end end end
Version data entries
27 entries across 27 versions & 6 rubygems