提交 65806622 编写于 作者: J Jeremy Kemper

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

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3151 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 d345b7a4
*SVN*
* Don't put flash in session if sessions are disabled. [Jeremy Kemper]
* Strip out trailing &_= for raw post bodies. Closes #2868. [Sam Stephenson]
* Pass multiple arguments to Element.show and Element.hide in JavaScriptGenerator instead of using iterators. [Sam Stephenson]
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册