John Smith
2009-Feb-15 17:12 UTC
How can I save the destination url with all the parameters?
I want too save the destination url with all the parameters (like some ids) in a variable session, so first I login the app and then redirect to this destination. How can I save this variable? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Jeff Lewis
2009-Feb-16 04:50 UTC
Re: How can I save the destination url with all the parameters?
If I understand what you''re asking, .... In your controller when you test whether a user is logged-in or not, if they aren''t logged in, you''ll want to save their current request uri in their session so that you can later redirect them to that orig destination once they''ve successfully logged in. Something like: ... # the place in your controller where you test logged-in-ness: if not is_user_logged_in session[:pre_login_req_uri] = request.env[''REQUEST_URI''] redirect_to(:action=>:login) return end ... # in your login meth, after the user has successfully logged-in: pre_login_uri = session[:pre_login_req_uri] session[:pre_login_req_uri] = nil if pre_login_req_uri redirect_to(pre_login_req_uri) else redirect_to(:action=>:index) end return ... Jeff On Feb 15, 9:12 am, John Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I want too save the destination url with all the parameters (like some > ids) in a variable session, so first I login the app and then redirect > to this destination. How can I save this variable? > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---