开发者

Rails 2.3.8 Redirecting: redirect_to back or default results in infinte log-in loop

开发者 https://www.devze.com 2023-04-06 23:19 出处:网络
map.connect \"/session\", :controller => \"sessions\", :action => \"new\" so, I decided to add the above line to my routes, because sometimes, the user may end up on /session somehow开发者_Sta
  map.connect "/session", :controller => "sessions", :action => "new"

so, I decided to add the above line to my routes, because sometimes, the user may end up on /session somehow开发者_StackOverflow中文版...

but when I did that, after I try logging in, the

redirect_back_or_default('/')

bit in sessions/create sends me back to /sessions instead of the previous url I actually tried to go to. le code:

def redirect_back_or_default(default)
  if not session[:return_to] =~ /session/
    redirect_to(session[:return_to] || default) 
  else
    redirect_to(default)
  end
  session[:return_to] = nil
end
0

精彩评论

暂无评论...
验证码 换一张
取 消