Use the database for sessions instead of the cookie-based default, which shouldn't be used to store highly confidential information
Create the session table with
rake db:sessions:create
Run the migration
rake db:migrate
Make sure you also tell rails to use ActiveRecord to manage your sessions too.
Rails 2
config/environment.rb:
config.action_controller.session_store = :active_record_store
Rails 3
config/initializers/session_store.rb:
Rails.application.config.session_store :active_record_store
本文介绍如何在Rails应用中配置数据库会话存储替代默认的cookie存储方式,包括创建会话表、运行迁移以及配置Rails 2和Rails 3的具体步骤。
7

被折叠的 条评论
为什么被折叠?



