1 module SessionPersistence
4 # Override this method if you don't want to use session[:_remember_for].
5 def session_persistence_key
11 # session_expires_after 1.hour
12 # session_expires_after 2.weeks
13 def session_expires_after(seconds)
14 session[session_persistence_key] = seconds
18 def session_expires_automatically
19 session.delete(session_persistence_key)
21 alias_method :expire_session, :session_expires_automatically
24 if session[session_persistence_key]
25 env["rack.session.options"][:expire_after] = session[session_persistence_key]