Doing will_paginate pages calculation around a record

Posted by Anderson De Andrade on Stack Overflow See other posts from Stack Overflow or by Anderson De Andrade
Published on 2010-05-29T04:05:07Z Indexed on 2010/05/29 4:12 UTC
Read the original article Hit count: 315

I'm displaying a list of events. I wanted displayed the page with the events for today by default. That was easy accomplished by:

page = number_of_records_before_RECORD / number_of_pages + 1

Now I want to display the first item of today's events as the first item in that page.

Maybe there is a way to generate page numbers around a record with negative values to get back.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby