3

我正在将现有应用程序从 Rails 2 迁移到 Rails 3。在旧环境文件中,SqlSessionStore 设置为:

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:database_manager => SqlSessionStore)
SqlSessionStore.session_class = MysqlSession

当尝试在 Rails 3 中启动我的应用程序时,我被告知:

DEPRECATION WARNING: config.action_controller.session= has been deprecated. Please use config.session_store(name, options) instead. (called from config/application.rb:35)
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing': uninitialized constant ActionController::CgiRequest (NameError)

有没有一种简单的方法可以将此概念转换为 Rails 3,或者我是否需要重新审视会话的处理方式?

4

1 回答 1

3

你在 application.rb 中想要这样的东西

module MyApp
  class Application < Rails::Application
    config.session_store :active_record_store

在此处查看文档和问题:http: //apidock.com/rails/ActiveRecord/SessionStore

于 2010-10-18T05:07:23.837 回答