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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---