# Pagination question

**URL:** <https://www.ruby-forum.com/t/pagination-question/98956>\
**Category:** Ruby\
**Created:** [July 19, 2006, 10:23am UTC](https://www.ruby-forum.com/t/pagination-question/98956 "2006-07-19T10:23:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSpalding\_Ssent\_by\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3be4f8/32.png) [@SSpalding\_Ssent\_by\_S](https://www.ruby-forum.com/u/SSpalding_Ssent_by_S)\
**Post date:** [July 19, 2006, 10:23am UTC](https://www.ruby-forum.com/t/pagination-question/98956/1 "2006-07-19T10:23:49Z")

</div>

I can’t seem to find the information I need about pagination.

It seems that by default the paginations scheme breaks things up from  
first  
to last. Does anyone know how one would be able to paginate from the  
last  
item entered to the first. the .reverse method only seems to reverse  
things  
‘within’ the page.

---

<div class="post-metadata">

**Author:** ![SSpalding\_Ssent\_by\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3be4f8/32.png) [@SSpalding\_Ssent\_by\_S](https://www.ruby-forum.com/u/SSpalding_Ssent_by_S)\
**Post date:** [July 19, 2006, 10:36am UTC](https://www.ruby-forum.com/t/pagination-question/98956/2 "2006-07-19T10:36:14Z")

</div>

On 19/07/06, SSpalding (sent by [Nabble.com](http://Nabble.com)) [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I can’t seem to find the information I need about pagination.

Presumably you’re talking about Ruby on Rails. Have you seen this?  
[http://wiki.rubyonrails.org/rails/pages/HowtoPagination](http://wiki.rubyonrails.org/rails/pages/HowtoPagination)

> It seems that by default the paginations scheme breaks things up from first  
> to last. Does anyone know how one would be able to paginate from the last  
> item entered to the first. the .reverse method only seems to reverse things  
> ‘within’ the page.

Assuming that you are talking about Rails, you just need to set the  
appropriate order in the query. So, to get from the last item created  
to the first, you could add “:order =\> ‘id DESC’”. If you want them in  
ascending order _within_ each page, then you need to call reverse on  
the result of that.

Finally, there’s a separate mailing list for Ruby _on Rails_ - this is  
a more general list (to which you are apparently posting via  
[nabble.com](http://nabble.com)). For Rails-specific questions, you’ll probably get better  
response in the appropriate list.

Paul.

---

<div class="post-metadata">

**Author:** ![SSpalding\_Ssent\_by\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3be4f8/32.png) [@SSpalding\_Ssent\_by\_S](https://www.ruby-forum.com/u/SSpalding_Ssent_by_S)\
**Post date:** [July 19, 2006, 10:45am UTC](https://www.ruby-forum.com/t/pagination-question/98956/3 "2006-07-19T10:45:33Z")

</div>

Ah, thanks so much. That I am, sorry about that.
