Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

WillPaginate::InvalidPage is neither an Exception nor a String #152

Closed
jwoertink opened this Issue Aug 10, 2011 · 1 comment

Comments

Projects
None yet
2 participants

Just upgraded an application to use will_paginate 3.0.0. In the application controller, I used to have this

rescue_from WillPaginate::InvalidPage do |exception|
render('public/404.html', :status => 404, :layout => false)
end

but now it throws this error saying "WillPaginate::InvalidPage is neither an Exception nor a String". Since InvalidPage is just an empty module, I'm wondering if maybe this is a rails bug with the rescue_from() ?

~Jeremy

@mislav mislav closed this in dc588e6 Aug 11, 2011

Owner

mislav commented Aug 11, 2011

Yeah, it's kind of a bug with Rails in the way that they didn't anticipate tag modules (which is exactly what InvalidPage is).

It will work if you pass 'WillPaginate::InvalidPage' as string. You can also use the latest master branch, where I just monkeypatched rescue_from to not choke on this module. But, if you upgrade to the master branch, you don't need to declare this block at all in the controller: InvalidPage exceptions will be automatically handled as 404s in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment