m33lky
m33lky

Reputation: 7275

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.

Upvotes: 5

Views: 3567

Answers (1)

m33lky
m33lky

Reputation: 7275

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

Upvotes: 15

Related Questions