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?
Here is the SO thread http://stackoverflow.com/questions/8608519/receiving-abstractcontrollerdoublerendererror-when-using-authenticate-or-reque
@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.