DoubleRender errors caused by authenticate_or_request_with_http_basic #10508

shyam-habarakada opened this Issue May 7, 2013 · 2 comments


None yet
2 participants

I ran into my controllers throwing double render errors while using authenticate_or_request_with_http_basic. The issue appeared to be that the authenticate_or_request_with_http_basic method does not return (exit) the current action flow, and falls through to other render logic in the controller.

A discussion on stack overflow pointed out that you could stick the authentication logic in a before_filter, to work around this issue, and that worked for me. However, I'm wondering if there is an improvement to be made here -- especially since I wanted a few hours trying to figure out what was going on and it could help others avoid it.

The current implementation has this code, which does not appear to properly return from the controller action, and would allow it to fall through to other code in the controller block.

Am I getting this right?

If yes, what can we do to fix this?


laurocaetano commented Apr 10, 2014

@shyam-habarakada I think this is the expected behavior, since it is documented here. It seems it does the same as your solution on the SO thread.

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