module Pagy::Backend
def pagy_countless_get_items(collection, pagy)
def pagy_countless_get_items(collection, pagy) # This should work with ActiveRecord, Sequel, Mongoid... items = collection.offset(pagy.offset).limit(pagy.items + 1).to_a items_size = items.size items.pop if items_size == pagy.items + 1 pagy.finalize(items_size) # finalize may adjust pagy.items, so must be used after checking the size items end