I have following line in my application which let default cookie expire date 20 minutes.
Rails.application.config.session_store :cookie_store, key: '_rails-omniauth_session', expire_after: 20.minutes
Bu I want to set specific expire date for some reasons. I have tried following lines but they couldn't make it.
request.session_options[:expire_after] = 2.years
ActionController::Base.session_options[:expire_after] = 2.years
How can set custom expire date ?
Ang suggestions,
Thanks.
If you need to set expiration period for sessions through all controllers in your application, simply add the following option to your
config/intializers/session_store.rb
file:If you need to set different expiration time in different controllers or actions, use the following code in action or some
before_filter
:Source