Question

My application retrieves items from remote source something like that:

# in the controller
@items = RemoteSource(params[:page]) 

The @items is an array but just the part of whole collection. And I'm trying to paginate it:

# in the view
paginate @items

Of course it doesn't work.

How I can paginate my collection in such situation?

P.S. I'm using gem kaminari

Was it helpful?

Solution

Try the Kaminari helper for this: @books = Kaminari.paginate_array(@items).page(params[:page])

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top