i’m trying to get my login and logouts to redirect to from where they
came. but because the login/logout controller runs twice (once when u
call it, and then when u login/logout) the referrer changes to the
login page. how can i prevent this?
here’s my code. tx:
def login
@from = params[:id]
session[:referer] = request.referer
@referer=session[:referer]
if request.post?
user = User.authenticate(params[:name], params[:password])
if user
session[:user_id] = user.id
session[:user_name] = user.name
redirect_to(session[:referer])
#redirect_to(:controller => “posts”, :action => “index”)
else
flash[:notice] = “Invalid user/password combination”
end
end
end