jeudi 9 septembre 2021

Pagy gem not returning the last page records

pagy,records = pagy(Products.all,page: params[:page], items: 5 )

i have total of 10 records. when i request for page 1 records, i get

#<Pagy:0x00007f1dec7cee88 @vars={:size=>[1, 4, 4, 1]}, @count=10, @items=5, @outset=0, @page=1, @last=2, @pages=2, @offset=0, @from=1, @to=5, @prev=nil, @next=2>

but for page 2, it gives

#<Pagy:0x00007faa0c7d0740 @vars={:size=>[1, 4, 4, 1]}, @count=10, @items=0, @outset=0, @page=2, @last=2, @pages=2, @offset=5, @from=6, @to=5, @prev=1, @next=nil>

may be because of from 6 to 5 its not returning me any records.

can someone help with what am i missing?

Aucun commentaire:

Enregistrer un commentaire