I am trying to deal with a redirection based upon what to do after a session has expired. I take the params hash and stuff it into a new session as part of the new login and then after login, I want to redirect to this hash as though they were params again... Thus I start by setting session[:direct_to] = @params And after I login, I want to redirect based upon the values in session[:direct_to]... What I am trying to do is this but I keep getting syntax errors... redirect_to (session[:direct_to].each do |key, value| "#{key} => #{value}" end) Of course there are values that are obvious such as session[:direct_to][:controller] session[:direct_to][:action] but there are a lot of other params that may or may not be included so I am trying to abstract and recover them in my redirect_to statement. Is there a way that I can do this? -- Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey, rather than store the params hash in the session, why not just store the actual redirection url? session[:direct_to] = url_for(params) redirect_to session[:direct_to] HTH Trevor On 2-Apr-07, at 11:06 AM, Craig White wrote:> > I am trying to deal with a redirection based upon what to do after a > session has expired. I take the params hash and stuff it into a new > session as part of the new login and then after login, I want to > redirect to this hash as though they were params again... > > Thus I start by setting > session[:direct_to] = @params > > And after I login, I want to redirect based upon the values in > session[:direct_to]... > > What I am trying to do is this but I keep getting syntax errors... > > redirect_to (session[:direct_to].each do |key, value| > "#{key} => #{value}" > end) > > Of course there are values that are obvious such as > session[:direct_to][:controller] > session[:direct_to][:action] > > but there are a lot of other params that may or may not be included > so I > am trying to abstract and recover them in my redirect_to statement. Is > there a way that I can do this? > > -- > Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
My - that was much simpler...thanks Craig On Mon, 2007-04-02 at 11:39 -0700, Trevor Squires wrote:> Hey, > > rather than store the params hash in the session, why not just store > the actual redirection url? > > session[:direct_to] = url_for(params) > > redirect_to session[:direct_to] > > HTH > Trevor > > On 2-Apr-07, at 11:06 AM, Craig White wrote: > > > > > I am trying to deal with a redirection based upon what to do after a > > session has expired. I take the params hash and stuff it into a new > > session as part of the new login and then after login, I want to > > redirect to this hash as though they were params again... > > > > Thus I start by setting > > session[:direct_to] = @params > > > > And after I login, I want to redirect based upon the values in > > session[:direct_to]... > > > > What I am trying to do is this but I keep getting syntax errors... > > > > redirect_to (session[:direct_to].each do |key, value| > > "#{key} => #{value}" > > end) > > > > Of course there are values that are obvious such as > > session[:direct_to][:controller] > > session[:direct_to][:action] > > > > but there are a lot of other params that may or may not be included > > so I > > am trying to abstract and recover them in my redirect_to statement. Is > > there a way that I can do this? > > > > -- > > Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> > > > > > > > > >-- Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---