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

Changeset 3151

Show
Ignore:
Timestamp:
11/21/05 18:09:28 (3 years ago)
Author:
bitsweat
Message:

Don't put flash in session if sessions are disabled.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r3137 r3151  
    11*SVN* 
     2 
     3* Don't put flash in session if sessions are disabled.  [Jeremy Kemper] 
    24 
    35* Strip out trailing &_= for raw post bodies. Closes #2868. [Sam Stephenson] 
  • trunk/actionpack/lib/action_controller/flash.rb

    r2747 r3151  
    133133        end 
    134134    end 
    135       
    136     
     135 
     136 
    137137    protected  
    138138      # Access the contents of the flash. Use <tt>flash["notice"]</tt> to read a notice you put there or  
    139139      # <tt>flash["notice"] = "hello"</tt> to put a new one. 
     140      # Note that if sessions are disabled only flash.now will work. 
    140141      def flash #:doc: 
    141         @session['flash'] ||= FlashHash.new 
     142        # @session = Hash.new if sessions are disabled 
     143        if @session.is_a?(Hash) 
     144          @__flash ||= FlashHash.new 
     145 
     146        # otherwise, @session is a CGI::Session or a TestSession 
     147        else 
     148          @session['flash'] ||= FlashHash.new 
     149        end 
    142150      end 
    143    
     151 
    144152      # deprecated. use <tt>flash.keep</tt> instead 
    145153      def keep_flash #:doc: 
     154        warn 'keep_flash is deprecated; use flash.keep instead.' 
    146155        flash.keep 
    147156      end 
    148    
    149    
    150       private 
     157 
     158 
     159    private 
    151160   
    152161      # marks flash entries as used and expose the flash to the view