Kaminari.paginate_array ArgumentError (invalid number of arguments (2 for 1)

I am using a rails application with a stone kaminari, and I have a shared array that I am trying to use on a page using the paginate_array method, but I get an ArgumentError (the wrong number of arguments (2 for 1) . Here is the code:

def index    

    page = params[:page] || 1
    items = ClientReports.search(params[:search], sort_column, sort_direction)
    @clients =  Kaminari.paginate_array(items, total_count: items.count).page(page)

    respond_with(@clients)

  end

Line: Kaminari.paginate_array(items, total_count: items.count).page(page)is the one that throws the error. Why is this a problem? From what I see in the docs , it is shown that this should be fine.

+1
source share
1 answer

ArgumentError (invalid number of arguments (2 for 1)

From docs ,

total_count Hash.

@paginatable_array = Kaminari.paginate_array([], total_count: 145).page(params[:page]).per(10)

,

@clients = Kaminari.paginate_array([items], total_count: items.count).page(page)
+3

Source: https://habr.com/ru/post/1610007/


All Articles