# Doozy of a pagination problem

**URL:** <https://www.ruby-forum.com/t/doozy-of-a-pagination-problem/155684>\
**Category:** Rails\
**Created:** [December 15, 2008, 4:19pm UTC](https://www.ruby-forum.com/t/doozy-of-a-pagination-problem/155684 "2008-12-15T16:19:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [December 15, 2008, 4:19pm UTC](https://www.ruby-forum.com/t/doozy-of-a-pagination-problem/155684/1 "2008-12-15T16:19:11Z")

</div>

Hey,

This is sort of complicated, and I’m trying to keep it as simple as I  
can.

I’m using will\_paginate to display only 25 snapshots on each page. My  
question is how can I return only the most recent snapshot per link  
(just one per link)?

@snapshots = Snapshot.paginate :order =\> ‘snapshots.weighted\_score  
desc’, :conditions =\> [“snapshots.scenario\_id = ? and (links.status = 1  
or links.status = 2 or links.status = 4)”, @scenario.id], :include =\>  
[:page, :link, {:snapshot\_attributes =\> :attribute}], :page =\>  
params[:page], :per\_page =\> 25

Let me know if any other information is needed, and thanks for any  
advice.
