I have an excel sheet / Yaml file containing few records. I was wondering if rails provide a way to achieve pagination while reading data from yaml document or excel sheet.
Asked
Active
Viewed 346 times
2 Answers
3
Try Kaminari gem. You can paginate through any kind of Array-ish object using Kaminari::PaginatableArray
> p Kaminari::PaginatableArray.new([*1..100]).page(3).per(20)
[41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]

Akira Matsuda
- 1,854
- 14
- 9
0
Another good pagination gem is will_paginate
It works really well with active record relations, and will also paginate arrays as long as you require the right file first. See https://stackoverflow.com/a/8407304/441979

Community
- 1
- 1

Alex Blakemore
- 11,301
- 2
- 26
- 49