rails Session :cookie_store set expiration per basis -
i need session remain around 30 days (using rails 3.2, cookie store).
i'd not to set global config in config.session_store, pass on alternative when session variable set, similar how can set expiration on cookie.
is possible?
if not, i'm planning globally set expiration of 30 days sessions, , utilize date variable in session var comparison/destroy if needed (but i'd rather not muck around).
if utilize cookies instead can so:
cookies[:foo] = { :value => "bar", :expires => 4.weeks.from_now }
see http://api.rubyonrails.org/classes/actiondispatch/cookies.html more information.
i not aware of way have variable session expiry, have manually.
something like:
def auth if session[:foo] reset_session if session[:last_seen] > 30.days.ago session[:last_seen] = time.now end end
ruby-on-rails session ruby-on-rails-3.2
No comments:
Post a Comment