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 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.
Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.