I'm looking for some clarification regarding the behaviour of redirect_to
.
I have this code:
if some_condition
redirect_to(path_one)
end
redirect_to(path_two)
If some_condition == true
I get this error:
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.
It seems that the method continues to execute after the redirect_to
call. Do I need to write code like this:
if some_condition
redirect_to(path_one)
return
end
redirect_to(path_two)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…