I'm using the will_paginate
gem. The default is 30 elements per page. How do I customize this?
Asked
Active
Viewed 1.1k times
9

double-beep
- 5,031
- 17
- 33
- 41

Justin Meltzer
- 13,318
- 32
- 117
- 182
2 Answers
11
If your controller is called User, you can do something like this in your controller:
@users = User.paginate :page => params[:page], :per_page => 10, :order => 'name ASC'
This will show 10 results per page.
In your view:
<%= will_paginate @users %>

Raunak
- 6,427
- 9
- 40
- 52
4
See the per_page
option here:
https://github.com/mislav/will_paginate/wiki
It will allow you to change the number displayed per page, for anytime that model is paginated.
For a controller/action specific approach see Raunak's answer.

Chris Cherry
- 28,118
- 6
- 68
- 71