Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cookie expiration time with activerecord session store

This question is a follow-up to this. I can't seem to change the expiration time on the cookie when I switched to ActiveRecord session store. It contains just the session_id like it should, but its expiration time is set to HTTP session. I tried setting it in application.rb:

config.session_store :cookie_store, {
  :expire_after =>  2.hours,
}

But it doesn't do anything.

I could hack it by creating an additional cookie and storing a session_id there, but that seems wrong.

like image 282
m33lky Avatar asked Dec 09 '22 02:12

m33lky


1 Answers

Nevermind, expiry of the cookie can be set by configuring ActiveRecord Session Store:

AppName::Application.config.session_store :active_record_store, 
    :key => 'your_cookie', 
    :expire_after => 2.hours
like image 138
m33lky Avatar answered Feb 12 '23 10:02

m33lky