Rails 3附加的会话配置选项(键,expires_after,安全)
||
有人可以指出新的Rails 3.x会话配置选项是什么吗?
我正在尝试复制与Rails 2.3.x应用程序中的配置相同的配置。
这是我在应用程序中使用的配置:
#environment.rb
config.action_controller.session_store = :active_record_store
config.action_controller.session = {
:key => \'_something\', #non-secure for development
:secret => \'really long random string\'
}
# production.rb - override environment.rb for production
config.action_controller.session = {
:key => \'_something_secure\',
:secret => \'really long random string\',
:expire_after => 60*60,#time in seconds
:secure => true #The session will now not be sent or received on HTTP requests.
}
但是,在Rails 3.x中,我只能提到以下内容:
AppName::Application.config.session_store :active_record_store
AppName::Application.config.secret_token = \'really long random string\'
AppName::Application.config.cookie_secret = \'another really long random string\'
还有其他配置设置来控制密钥,expire_after时间和安全选项吗?
关于后者,如果在production.rb中设置了\“ config.force_ssl = true \”,那么我认为不再需要安全选项了吗?
非常感谢!
没有找到相关结果
已邀请:
1 个回复
膏焦凑
中)配置基于Cookie的会话存储。在Rails 3中,会话存储是一个中间件,并且通过一次调用
来传递配置选项:
您可以使用
在哈希中添加所需的任何其他选项,例如
(这些只是标准默认值) 如果您在生产中强制使用SSL,那么在cookie上设置安全性实际上并不会有所不同,但是您可能希望将其设置为安全起见。