Reputation: 410
My Rails app is throwing a AbstractController::DoubleRenderError
. You can see my controller action below, it does include multiple render and/or redirects, however, I've read and found that doing it with a return should negate this exception.
Here is my controller action:
def load
redirect_to login and return if @current_login == nil
render template: 'app' and return if @current_login
end
I've verified that @current_login
is nil
, meaning it should redirect and return.
Upvotes: 0
Views: 158
Reputation: 410
Changing redirect_to login
to redirect_to '/login'
did the trick.
I had a controller action login
in the same controller as the load
action, so it was calling the login
action, which had a render
call in it...
Hopefully someone runs into the same coincidence and this helps them.
Upvotes: 1