"0" given as value, which translates to '0' as page number
Generally, we will be redirecting to 404 error page.But the possible things we can do in our controllers part are
1.By checking the params[:page] we can raise Argument Error, "'page' setting cannot be less than 1
2.params[:page]=params[:page].to_i <=0 ? 1 : params[:page]
When any passes the value of the page to less than zero,it will displays the result with page value 1.
Thanks, I used this to fix this problem, only I revised the code to:
ReplyDeleteparams[:page] = 1 if params[:page].to_i <= 0
No biggie, just a tad more readable.