This turned out to be a bug in the Monban gem I was using for authentication. It is built on top of Warden but failed to configure a "Failure App" as required by that gem.
I raised the issue, and apparently it has been resolved.
Question
In my controller I want to respond to an ajax request with an http 401 (unauthorized) error if the user is not logged in. However, the code below throws a 500 internal server error instead. Rails gives the error: "No Failure App Provided".
If I use other http error codes such as :bad_request (400) it works fine. The problem seems to only be with 401 error codes. Why is this?
if signed_in?
...
else
respond_to do |format|
format.html { head :unauthorized }
end
end
Solution
This turned out to be a bug in the Monban gem I was using for authentication. It is built on top of Warden but failed to configure a "Failure App" as required by that gem.
I raised the issue, and apparently it has been resolved.