'Setting session timeout in Rails 6
I need help on the timeout configuration on the rails 6. I tried to configure the /config/initializers/devise.rb, but it's not working, any assist will be appreciated.
Step 1: Go to /config/initializers/devise.rb configure:
config.timeout_in = 1.minutes
Step 2: Go to /app/models/user.rb Set :timeoutable in the user model.
class User < ActiveRecord
devise :timeoutable
end
Step 3: Systemctl restart nginx Success! 🎉
System informations:
ruby -v ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-linux] rails -v Rails 6.0.0 Running on the CentOS 7.
Reference: https://github.com/plataformatec/devise
Solution 1:[1]
Did you set :timeoutable
in User model? For example:
class User < ActiveRecord::Base
devise :timeoutable
end
and with this setting set this value config.timeout_in = 1.minutes
in /config/initializers/devise.rb
as before.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | nuaky |