will_paginate link to nested resources
- by neotracker
Hi, I'm using the will paginate gem from http://github.com/mislav/will_paginate
Routes:
map.resources :post do |post|
post.resources :comments
end
Post Controller:
@post = Post.first
@comments = @post.comments.paginate :page => params[:page], :per_page => 10
My problem lies in the view:
<%= will_paginate @comments %>
This generates links like /post/1?page=1
What I need is /post/1/comments?page=1
Is there a way to just tell will_paginate what url helper to use? (like post_comments_path)
Any ideas?