Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

r3305@asus: jeremy | 2005-11-23 17:33:51 -0800

 Apply [3151] to stable.  Don't put flash in session if sessions are disabled.


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@3178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 3fcec37473dcc48049b44b156747a15fc8816970 1 parent 15839d5
@jeremy jeremy authored
Showing with 18 additions and 7 deletions.
  1. +2 −0  actionpack/CHANGELOG
  2. +16 −7 actionpack/lib/action_controller/flash.rb
View
2  actionpack/CHANGELOG
@@ -2,6 +2,8 @@
* Make ActionController's render honor the :locals option when rendering a :file. #1665. [Emanuel Borsboom, Marcel Molina Jr.]
+* Don't put flash in session if sessions are disabled. [Jeremy Kemper]
+
* Strip out trailing &_= for raw post bodies. Closes #2868. [Sam Stephenson]
* Correct docs for automatic layout assignment. #2610. [Charles M. Gerungan]
View
23 actionpack/lib/action_controller/flash.rb
@@ -132,22 +132,31 @@ def use(k=nil, v=true)
end
end
end
-
-
+
+
protected
# Access the contents of the flash. Use <tt>flash["notice"]</tt> to read a notice you put there or
# <tt>flash["notice"] = "hello"</tt> to put a new one.
+ # Note that if sessions are disabled only flash.now will work.
def flash #:doc:
- @session['flash'] ||= FlashHash.new
+ # @session = Hash.new if sessions are disabled
+ if @session.is_a?(Hash)
+ @__flash ||= FlashHash.new
+
+ # otherwise, @session is a CGI::Session or a TestSession
+ else
+ @session['flash'] ||= FlashHash.new
+ end
end
-
+
# deprecated. use <tt>flash.keep</tt> instead
def keep_flash #:doc:
+ warn 'keep_flash is deprecated; use flash.keep instead.'
flash.keep
end
-
-
- private
+
+
+ private
# marks flash entries as used and expose the flash to the view
def fire_flash
Please sign in to comment.
Something went wrong with that request. Please try again.