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
精彩评论