Hi, I am trying pagination with using the plug-in: will_paginate.
Here is my code, I got a scaffold model named “post”.
I insert the following code in the index method
@posts = Post.paginate :page => params[:page], :per_page => 3
I insert the the following code at the bottom of file
<%= will_paginate @posts %>
Then I run it, but got the following error message. What I missed??
NoMethodError in Posts#index
Showing posts/index.html.erb where line # raised:
protected method `url_for’ called for #<WillPaginate::LinkRenderer:
The will_paginate version of mine is: 2.2.1
I think to use the pagination mechanism provided by will_paginate
should be easy.
Could somebody give me a guide? Thanks!