# Pagination per\_page using select\_box

**URL:** <https://www.ruby-forum.com/t/pagination-per-page-using-select-box/135595>\
**Category:** Rails\
**Created:** [April 23, 2008, 1:53pm UTC](https://www.ruby-forum.com/t/pagination-per-page-using-select-box/135595 "2008-04-23T13:53:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrianod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c2a13f/32.png) [@adrianod](https://www.ruby-forum.com/u/adrianod)\
**Post date:** [April 23, 2008, 1:53pm UTC](https://www.ruby-forum.com/t/pagination-per-page-using-select-box/135595/1 "2008-04-23T13:53:49Z")

</div>

I want to pass the number of pages in a select box (10,15,25,50) and  
when I press some button or just doing the action (observer\_field?) it  
will change the pagination, how can i do it ?

---

<div class="post-metadata">

**Author:** ![adrianod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c2a13f/32.png) [@adrianod](https://www.ruby-forum.com/u/adrianod)\
**Post date:** [April 23, 2008, 11:56pm UTC](https://www.ruby-forum.com/t/pagination-per-page-using-select-box/135595/2 "2008-04-23T23:56:08Z")

</div>

Make the select box submit params[:per\_page] (name=“per\_page”)  
onChange. You’ll also want it to go back to the first page  
(params[:page] = 1) or else you could request an invalid page (e.g.,  
there is no page 7 at 50 items per page when you only have 100 items,  
even if you were on page 7 when viewing 10 items per page). Pass  
per\_page and page to the paginate call.

-Kyle

On Apr 23, 6:53 am, Adriano L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
