I have this controller code:
def update
super
respond_to do |format|
format.html{redirect_to session[:redirect_to]}
end
end
My class inherits from devise Passwords like this:
class Mobile::PasswordsController < Devise::PasswordsController
and I get this error:
AbstractController::DoubleRenderError in Mobile::PasswordsController#update
Render and/or redirect were called multiple times in this action.
Please note that you may only call render OR redirect, and at most once per action.
Also note that neither redirect nor render terminate execution of the action, so
if you want to exit an action after redirecting, you need to do something like
"redirect_to(...) and return".
Any idea what to do? I know its the redirects, but I am not sure how to make them right.
Thanks!
The
updatemethod of the Devise gem already has a redirect. Then you call your redirect and this causes the error. If you want to do a custom redirect you need to override a Devise method without asupercall like this: