I have created user login's that work with sessions. I am trying to make a timed logout, so that when the user is idle for a minute, they are logged out. If their login time's out, they should be redirected to controller Headline and action Index. In my application.rhtml I periodically call a function in application controller called session_expiry... i do that like this:

<%= periodically_call_remote :frequency => 10, :update => "all", :url => { :controller => "application", :action => "session_expiry"} %>

here is the function in application controller

  def session_expiry
    @time_left = (session[:expires_at] - Time.now).to_i
    unless @time_left > 0
      reset_session
      render_component :controller => "headline", :action => "index"
    end
  end

The PROBLEM:
When the session ISN'T timed out, then session_expiry doesn't render anything, and doesn't have session_expiry.rhtml - this throws an error. I want session_expiry to not render anything when the user isn't timed out, so that they stay on the page they were on. How do I accomplish this?
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to