quinta-feira, 5 de fevereiro de 2009

Multiple paginate in one page

So I need to paginate more than one collections in one page only
and couldn't find no sollution and thought about to recreate the wheel
and make myself a poor version of will_paginate, but I found this reply
of mislav (THANKS to that!!!) with a very simple solution use the :param_name
of will_paginate it solves my problem very easily

Original Topic

# controller
@products = Product.paginate(:page => params[:products_page])
@posts = Post.paginate(:page => params[:posts_page])

# view
<%= will_paginate @products, :param_name => 'products_page' %>
<%= will_paginate @posts, :param_name => 'posts_page' %>

Nenhum comentário:

Postar um comentário