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,