Just like ActiveRecord::RecordNotFound which returns a 404 error page when raised, ActiveSupport::MessageVerifier::InvalidSignature should display a 403 error page to the user, and not a 500 internal server error.
Just like find, also find_signed! is widely used in controllers. The problem is that when the signature is invalid or expired the exception raised causes a 500 error instead of a meaningful message.
My current workaround is this:
class ApplicationController < ActionController::Base
rescue_from ActiveSupport::MessageVerifier::InvalidSignature do |e|
head :forbidden # or render something...
end
end
However I think that ActiveSupport::MessageVerifier::InvalidSignature should be handled directly by Rails in a way similar to ActiveRecord::RecordNotFound. In this way we could just customize a public/403.html and nothing else (which seems the correct Rails-way).