RailsCasts Pro episodes are now free!

Learn more or hide this

John Schank's Profile

GitHub User: jschank

Comments by John Schank


Heh, I answered my own question. In my case, I grouped my events by start.to_date, an then took the keys and paginated that array. This allowed me to return the first page of so many dates, and then the next page, and it doesn't matter how many calendar dates fall between them. (so I don't have pages of empty data this way for gaps in the dates)

tl;dr: I figured it out. Thanks!


This may be a newbie question but here goes...
Suppose my data is date based. (Like events on a calendar), and I want my "pages" to correspond to some units of time. For example, some number of weeks.
So that page 1 is events occurring in next 2 weeks from today... and Page 2 is events occurring in the next 2 weeks.... etc.
In this case, a page isn't a fixed number of items. It may be many or few.

In this use case, is pagination via kaminari something I should be using, or should I be hacking together something specific to my scenario? And if so, does anyone have any pointers to where to go for advice?