Getting the session variables after a redirect_to

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.

show the code that sets them, then show the code the gets them :slight_smile:

Brian H. wrote:

show the code that sets them, then show the code the gets them :slight_smile:

************ 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!

Marco Freire wrote:

Brian H. wrote:

show the code that sets them, then show the code the gets them :slight_smile:

************ 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