From 53ee2c96337d16be9a86710d8179941d16895b98 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 13 Sep 2005 07:46:57 +0000 Subject: Added ActionController::Base.session_store=, session_store, and session_options to make it easier to tweak the session options (instead of going straight to ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 59160c3e81..0bfa261e7a 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -346,6 +346,26 @@ module ActionController #:nodoc: require 'action_controller/upload_progress' include ActionController::UploadProgress end + + # Set the session store to be used for keeping the session data between requests. The default is using the + # file system, but you can also specify one of the other included stores (:active_record_store, :drb_store, + # :mem_cache_store, or :memory_store) or use your own class. + def session_store=(store) + ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] = + store.is_a?(Symbol) ? CGI::Session.const_get(store.to_s.camelize) : store + end + + # Returns the session store class currently used. + def session_store + ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] + end + + # Returns the hash used to configure the session. Example use: + # + # ActionController::Base.session_options[:session_secure] = true # session only available over HTTPS + def session_options + ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS + end end public -- cgit v1.2.3