How can I use will_paginate with a custom route?
I have the following in my routes:
map.connect \'human-readable/:name\', :controller => :tags, :a
The will_paginate view helper has a :params option for overriding the default link generation.
Change your routes configuration:
map.human_readable_tag '/human-readable/:name',
:controller => :tags, :action => 'show'
Invoke the will_paginate view helper as follows:
<%= will_paginate @tag_list,
:params => {:controller => human_readable_tag_path(@tag_name) } %>
Make sure you have set the @tag_name variable in your controller.
For more information read the will_paginate view helper documentation.
The :params option passed to the helper is used to invoke url_for. So read the url_for documentation for how we faked a controller name.