Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3109

Show
Ignore:
Timestamp:
11/20/05 09:06:43 (3 years ago)
Author:
bitsweat
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r3058 r3109  
    9494      unless @session 
    9595        if @session_options == false 
    96           @session = Hash.new 
     96          @session = disabled_session_hash 
    9797        else 
    9898          stale_session_check! do 
     
    122122      def new_session 
    123123        if @session_options == false 
    124           Hash.new 
     124          disabled_session_hash 
    125125        else 
    126126          CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => false)).delete rescue nil 
    127127          CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => true)) 
    128128        end 
     129      end 
     130 
     131      def disabled_session_hash 
     132        Hash.new { |h,k| raise "You disabled sessions but are attempting to set session[#{k.inspect}]" } 
    129133      end 
    130134