Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Rails provide default session time-out duration? If yes, where is it specified?

I already know how to set expiry time duration in rails app, which has been documented very well on web. But what I want to know is what is the default time duration for session expiry in rails and if there is one, where to find it?

like image 422
shailesh Avatar asked Apr 25 '13 12:04

shailesh


2 Answers

Rails doesn't have a default expiration time. The method definition for session_store seems to have only one default:

On line 32 @session_store = :cookie_store

By default the other configurations are non existent. Therefore, :expire_after is not set and Rails' sessions don't have expiration time unless you set a value for it.

like image 104
sargas Avatar answered Oct 21 '22 14:10

sargas


You can configure the application's session information in the initializer file

config/initializers/session_store.rb

For setting 30 minutes try the below code :

 YourApp::Application.config.session_store :cookie_store, 
    :key => '_my_session', 
    :expire_after => 30.minutes
like image 26
user2319761 Avatar answered Oct 21 '22 14:10

user2319761