mohit
mohit

Reputation: 1973

Pagination in static pages

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.

Upvotes: 1

Views: 357

Answers (2)

Alex Blakemore
Alex Blakemore

Reputation: 11896

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

Upvotes: 0

Akira Matsuda
Akira Matsuda

Reputation: 1854

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]

Upvotes: 3

Related Questions