# Paginating\_find - selecting 20+ records grouped by date without breaking the day across multiple pa

**URL:** <https://www.ruby-forum.com/t/paginating-find-selecting-20-records-grouped-by-date-without-breaking-the-day-across-multiple-pa/140710>\
**Category:** Rails\
**Created:** [June 17, 2008, 8:24pm UTC](https://www.ruby-forum.com/t/paginating-find-selecting-20-records-grouped-by-date-without-breaking-the-day-across-multiple-pa/140710 "2008-06-17T20:24:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [June 17, 2008, 8:24pm UTC](https://www.ruby-forum.com/t/paginating-find-selecting-20-records-grouped-by-date-without-breaking-the-day-across-multiple-pa/140710/1 "2008-06-17T20:24:43Z")

</div>

Hi there, I’m using the paginating\_find plugin for one of my more  
popular apps. I’ve gotten a few requests from users asking not to  
break records associated with a given date across multiple pages.  
Right now, I specify the size of a record set as part of the find i.e.  
20 records (see below). That generally will allow for 2 or 3 days of  
records, cutting the 4th day, as an example, across two pages.

I need that to be more flexible to return a minimum of 20 records, but  
to grab all records for a given day if 20 records is going to cut any  
day across multiple pages. Not sure how to structure that though?  
Below is an example of the paginating find I’m currently using:

@diary = Entries.find(:all, :conditions =\> [“user\_id = ? and  
created\_at LIKE ?”,@diary\_owner.id, params[:date] + ‘%’], :page =\>  
{:size =\> 20, :current =\> params[:page], :first =\> 1}, :order =\>  
‘created\_at desc’)

Has anyone else had to solve this same problem either with  
paginating\_find or without? I look forward to your suggestions.

Thanks!  
-A
