【发布时间】:2011-09-17 20:40:30
【问题描述】:
谁能指出新的 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”,我认为不再需要安全选项?
非常感谢!
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 session-state session-variables