I've done it now with some before_filters:
class ApplicationController < ActionController::Base
before_filter :update_session, :check_if_session_is_valid
...
def check_if_session_is_valid
session_timeout = current_user.try(:session_timeout) || 1800
if session[:timestamp] <= session_timeout.seconds.ago.to_i
session[:user_id] = nil
end
end
def update_session
session[:timestamp] = Time.now.to_i
end
And in the controller which is used by the poller i added this (the session shouldn't get updated by the poller):
skip_before_filter :update_session, :only => :get_new