Hi! I set some session variables on a login_controller and i want to access them after a redirect_to (:controller => "auditor", action => "check"). The problem is that the session variable are comming empty in the auditor view!! I tough that session variables last trought all controllers...iam wrong? Please tell me. -- 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 -~----------~----~----~----~------~----~------~--~---
show the code that sets them, then show the code the gets them :) On 7/18/07, Marco Freire <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hi! > > I set some session variables on a login_controller and i want to access > them after a redirect_to (:controller => "auditor", action => "check"). > The problem is that the session variable are comming empty in the > auditor view!! > I tough that session variables last trought all controllers...iam wrong? > Please tell me. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan wrote:> show the code that sets them, then show the code the gets them :)************ login_controller **************** def login #close_session if request.post? obj = Cvsops.new output, status, error = obj.trylogin(params[:server], params[:name], params[:password]) if status != 0 flash.now[:notice] = "Error : #{error}" else session[:status] = status session[:name] = params[:name] session[:password] = params[:password] session[:server] = params[:server] redirect_to(:controller => "auditor", :action => "checkpre") end end end *************************************************** **************** auditor controller ************************* def checkpre # clean_session if request.post? obj = Checker.new output, status, error = obj.check(params[:module], session[:server], session[:name], session[:password]) info = obj.parseoutput(output) session[:module] = params[:module] session[:info] = info session[:status] = status session[:error] = error redirect_to(:action => "check") end end ************************************************ Debuging the auditor controller i get the session[:server], session[:name] and session[:password] blank! -- 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 -~----------~----~----~----~------~----~------~--~---
Marco Freire wrote:> Brian Hogan wrote: >> show the code that sets them, then show the code the gets them :) > > ************ login_controller **************** > > def login > #close_session > if request.post? > obj = Cvsops.new > output, status, error = obj.trylogin(params[:server], > params[:name], params[:password]) > if status != 0 > flash.now[:notice] = "Error : #{error}" > else > session[:status] = status > session[:name] = params[:name] > session[:password] = params[:password] > session[:server] = params[:server] > redirect_to(:controller => "auditor", :action => "checkpre") > end > end > end > > *************************************************** > > **************** auditor controller ************************* > > def checkpre > # clean_session > if request.post? > obj = Checker.new > output, status, error = obj.check(params[:module], > session[:server], session[:name], session[:password]) > info = obj.parseoutput(output) > session[:module] = params[:module] > session[:info] = info > session[:status] = status > session[:error] = error > redirect_to(:action => "check") > end > end > > ************************************************ > > Debuging the auditor controller i get the session[:server], > session[:name] and session[:password] blank!I forgot...the check action... def check @info = session[:info] if session[:status] == 0 flash.now[:notice] = "Compliance check created for module: #{session[:module]}" else flash.now[:notice] = session[:error] end end -- 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 -~----------~----~----~----~------~----~------~--~---