#rraut-pagination

1 messages ยท Page 1 of 1 (latest)

remote elm
untold kindle
#

After auto paging result still says has_more: true. Why is that ?

#

Rather then using block I just called auto paging on object like this @visual starnsaction.auto_paging_each

remote elm
#

Can you clarify what you mean? What exactly does your code look like?

untold kindle
#

So I get all balance transactions like this Stripe::BalanceTransaction.list(some id).auto_paging_each

#

So I was expecting to get all the transactions

#

But it return has_more: true

#

So tat means there r more items needs to be paginated ?

remote elm
#

Can share your exact code - specifically, I want to see what your printing/logging that's showing has_more: true

#

I need to head out, but if you have any follow up questions @quartz yarrow r can help!

untold kindle
quartz yarrow
#

๐Ÿ‘‹ Taking over this thread

#

@transactions is the first page. auto_paging_each will continue the retrieve remaining object one by one from @transactions.

Sample code will be:

customers = Stripe::Customer.list({limit: 3})
customers.auto_paging_each do |customer|
  # Do something with customer
end
untold kindle
#

Ya seen tat. Donโ€™t need to pass block. Works fine without block as well. But it return incorrect value has_many: true.

#

After auto pagination has_many should return false.

quartz yarrow
#

Auto-pagination here will continue looping inside the do function until whole list ends. You should not assign @transactions.auto_paging_each to a variable as it's still iterating

#

auto_paging_each supports iterating the object individually and does not return whole list

untold kindle
#

Ok thanks

quartz yarrow
#

No problem! Happy to help ๐Ÿ˜„

untold kindle
#

Will modify my code