I think you will have to do this manually since the active record store does not implement the expire_after option. So within your (I assume) before filter, you should do this:
def authenticate
if session[:logged_in]
reset_session if session[:last_seen] < 2.minutes.ago
session[:last_seen] = Time.now
else
... authenticate
session[:last_seen] = Time.now
end
end
Obviously, this is not complete, but it should give you the basic idea.
UPDATE:
It seems that the functionality IS present in rails since version 2.3. I found the relevant code here. This is AbstractStore which should serve as base class for all derived ones. So, as dadooda suggests, the following should work:
Some::Application.config.session_store :active_record_store, {
expire_after: 24.hours,
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…