Session expires, automatic logout

I am trying to implement an automatic logout for an online application I
am building. The idea is that after an hour of inactivity to have the
page autmoatically logout itself. The main part of my code is as
follows:

if !session[:expire][:expires].blank?
@time_left = (session[:expire][:expires] - Time.now).to_i
else
@time_left = 0
end

if @time_left.to_i <= 0
flash[:notice] = “<b style = color: red;>You have been logged out due
to
inactivity”
session[:expire] = nil
redirect_to :action => ‘login’ and return
else
redirect_to :action => pattern, :id => params[:id], :from_expiry=>
“true”
end

However, when the code get to the if statement that redirects the page
to the login page, it enters the if but fails to redirect the page and
it doesn’t seemt o be throwing any errors. Any idead on how to get this
to work? Thanks,

-S

I should also mention the periodic call function that is used to check
is the session time has expired:

<%= periodically_call_remote :update => ‘content’, :url => {:action =>
‘session_expiry’, :id => @user.id, :manager => @manager.blank? ? ‘’ :
@manager.id, :controller => ‘enroll’ }, :frequency => ‘60’ %>

One thing that I noted in the logs is this line when I try and render
the login page after time expires:

Rendering layoutfalse within layouts/simple

This is different then the other pages that I render:

Rendering layoutfalse within layouts/simple

Everything seems to work other then the fact that the page is not render
after the periodic_call and time expires. THanks again,

-S

Everything seems to work other then the fact that the page is not render
after the periodic_call and time expires. THanks again,

Doing a redirect from an ajax request won’t do what you think it does.
You have to use rjs and use the rjs redirect_to.

Fred