2017-08-24 209 views
0

我在devise.rb初始化如下:什么是devise config.remember_for默认值?

# ==> Configuration for :rememberable 
    # The time the user will be remembered without asking for credentials again. 
    # config.remember_for = 2.weeks 

什么是色器件所使用的默认时注释掉?没有为此设置指定。是2.weeks还是无限?我在文档中发现矛盾的信息。我在Devise 3.5.10上。

回答

0

看看gem's code directly你可以发现它默认为2周。例如here的评论:

# * +remember_for+: the time you want the user will be remembered without 
    #  asking for credentials. After this time the user will be blocked and 
    #  will have to enter their credentials again. This configuration is also 
    #  used to calculate the expires time for the cookie created to remember 
    #  the user. By default remember_for is 2.weeks. 

here它实际上是设置:

mattr_accessor :remember_for 
@@remember_for = 2.weeks