Question

I am migrating an existing application from Rails 2 to Rails 3. In the old environment file, SqlSessionStore was set up with:

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

When trying to start my application in Rails 3, I'm told:

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)

Is there an easy way to translate this concept over to Rails 3, or do I need to revisit how sessions are handled?

Was it helpful?

Solution

You want something like this in application.rb

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

See the docs and questions here: http://apidock.com/rails/ActiveRecord/SessionStore

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top