will_paginate link to nested resources
Posted
by neotracker
on Stack Overflow
See other posts from Stack Overflow
or by neotracker
Published on 2010-05-12T13:02:32Z
Indexed on
2010/05/12
13:04 UTC
Read the original article
Hit count: 269
ruby-on-rails
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?
© Stack Overflow or respective owner