Skip to content

Commit 8b3ef20

Browse files
committed
Use Kaminari.paginate_array when the collection is an Array
Signed-off-by: David Celis <[email protected]>
1 parent a7e19d9 commit 8b3ef20

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/api-pagination.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def paginate(collection, options = {}, &block)
1111

1212
case ApiPagination.paginator
1313
when :kaminari
14+
collection = Kaminari.paginate_array(collection) if collection.is_a?(Array)
1415
collection.page(options[:page]).per(options[:per_page]).tap(&block)
1516
when :will_paginate
1617
collection.paginate(:page => options[:page], :per_page => options[:per_page]).tap(&block)

0 commit comments

Comments
 (0)