My Rails-app has a sign in box with a "remember me" checkbox. Users who check that box should remain logged in even after closing their browser. I'm keeping track of whether users are logged in by storing their id in the user's session.
But sessions are implemented in Rails as session cookies, which are not persistent. I can make them persistent:
class ApplicationController < ActionController::Base
options = ActionController::Base.session_options
options[:session_expires] = 1.year.from_now
But that seems like a hack, which is surprising for such common functionality. Is there a better way?
Last updated:12/28/2014 11:55:27 PM