lib/active_admin/views/components/paginated_collection.rb in activeadmin-3.2.4 vs lib/active_admin/views/components/paginated_collection.rb in activeadmin-3.2.5
- old
+ new
@@ -101,10 +101,13 @@
# The #paginate method in kaminari will query the resource with a
# count(*) to determine how many pages there should be unless
# you pass in the :total_pages option. We issue a query to determine
# if there is another page or not, but the limit/offset make this
# query fast.
- offset = collection.offset(collection.current_page * collection.limit_value).limit(1).count
+ offset_scope = collection.offset(collection.current_page * collection.limit_value)
+ # Support array collections. Kaminari::PaginatableArray does not respond to except
+ offset_scope = offset_scope.except(:select, :order) if offset_scope.respond_to?(:except)
+ offset = offset_scope.limit(1).count
options[:total_pages] = collection.current_page + offset
options[:right] = 0
end
text_node paginate collection, **options