Forum: Ruby on Rails will_paginate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
fRAnKEnSTEin (Guest)
on 2009-02-16 12:15
(Received via mailing list)
Hi there,

I am paginating my products using "will_paginate"(12 items per page),
and i added this line to my routes file, for make "wil_paginate" work
with friendly url's:

map.paginated_product 'products/page/:page', :controller =>
'products', :action => 'index', :page => 1

1- First question: when i load my product index page, i want the url
be like "http://localhost:3000/products/page/1" instead "http://
localhost:3000/products/" how can i do this? in fact i want that
"http://localhost:3000/products/page/1" be the only url for accesing
the products index, is this posible?

When one clicks on any product, the url becomes: "http://localhost:
3000/products/page/1/product/1" so that means that i am in page number
1 viewing product number 1.

2- Second question: when i click any paging links, my URL changes the
page number, but will remain the "/product/1" at the end of the url.
So if a click on the number 2 page link, the url will look like:
"http://localhost:3000/products/page/2/product/1" instead of  "http://
localhost:3000/products/page/1/product/12", product wit id 12 is the
first one that apears in the page number 2, so i have to see that id
product in url intead of 1, how can i do this?

Regards
This topic is locked and can not be replied to.