1. Install the pagination plugin:
ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate
2. Type the following in your controller:
@products = Product.paginate(:page => params[:page], :per_page => 25)
3. Type the following in your view:
<%= will_paginate @products %>
The better thing comparing to rails 1.x pagination is that it is now easier to understand and remember. Isn't it more conventional?
1 comment:
Hi Xiaobo
I just started learning Rails.
I got the error "undefined method paginate..." and ran the command to install the will_paginate plugin but it returns nothing.
When I start Mongrel and refresh my webpage..I get the same error again
Can u post anything for this
Post a Comment