You’re not receiving notifications from this thread.
Pagination with will_paginate Discussion
That was a great screencast! Keep up the good work. I was just wondering if there's a way to limit users from accessing pages without any posts? Maybe by editing routes.rb?
You could probably do something like this in your controller:
@posts = Post.paginate(page: params[:page])
redirect_to root_path if @posts.empty?
If you are a noob like me and it doesn't work try adding ', :per_page => 1' as your controller pagination option.
I was working with seed data with only 10 customers in it so will_paginate was not rendering because the default 30 meant there was no reason to render it at all! I swore I had some bug but turns out it was just that.
Great idea! I've done that in the past when I wasn't sure why it wasn't rendering and that helped a lot. :)
I wish this was stated in the docs! Have just spent a hour trying to figure this out and it just turned out I didn't have enough data.... :(
Fantastic video. Thank you!
Doesn't work with 4.2
I have a multi page group member list list with a drop down selection box where one can edit a membership role, which is tied to an enum value.
It works, but in the case where one make edits on 2 or more separate pages and then updates, only the edit(s) on the current page are saved.
Is this the expected behavior? It obviously wipes out attributes when pagination occurs, but it does not seem intuitive to expect the user to update between switching pages.
... or maybe I'm just abusing will_paginates' purpose.
hello, please I tried using the will_paginate gem but am getting this error whenever I introduce the pagination link
link -- <%= will_paginate @ articles %>
error --- wrong number of arguments (given 2, expected 1)
please how do I go about this?
Ohre - you need to remove the space between @ and articles so it is just @articles