Setting the session base domain in Rails 2.3
Prior to Rails 2.3, you could set the session base domain as follows:
ActionController::Base.session_options[:session_domain] = '.example.com'
In Rails 2.3, this needs to change to:
config.action_controller.session[:domain] = '.example.com'
I usually set this in my config/environments/.rb configuration files but it could be set in config/environment.rb if you want it to apply across configurations.
Background
This setting will allow for a shared session across multiple subdomains.
This is useful where you want a user to login at www.example.com and then be able to remain logged in when accessing user.example.com
Comments
Have your say