aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-20 09:06:43 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-20 09:06:43 +0000
commitda9f713d2c3be94361579d41645ed79e15958686 (patch)
tree0212033244aee88e55f4c37f5faa4727f367cf47 /actionpack
parent63b792162bd999c873a4c66936ac36ac5943d53b (diff)
downloadrails-da9f713d2c3be94361579d41645ed79e15958686.tar.gz
rails-da9f713d2c3be94361579d41645ed79e15958686.tar.bz2
rails-da9f713d2c3be94361579d41645ed79e15958686.zip
r3209@asus: jeremy | 2005-11-20 01:04:22 -0800
If sessions are disabled, return a hash that raises an error when it's accessed. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb
index 812899b327..c0cbc22edd 100644
--- a/actionpack/lib/action_controller/cgi_process.rb
+++ b/actionpack/lib/action_controller/cgi_process.rb
@@ -93,7 +93,7 @@ module ActionController #:nodoc:
def session
unless @session
if @session_options == false
- @session = Hash.new
+ @session = disabled_session_hash
else
stale_session_check! do
if session_options_with_string_keys['new_session'] == true
@@ -121,13 +121,17 @@ module ActionController #:nodoc:
# Delete an old session if it exists then create a new one.
def new_session
if @session_options == false
- Hash.new
+ disabled_session_hash
else
CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => false)).delete rescue nil
CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => true))
end
end
+ def disabled_session_hash
+ Hash.new { |h,k| raise "You disabled sessions but are attempting to set session[#{k.inspect}]" }
+ end
+
def stale_session_check!
yield
rescue ArgumentError => argument_error