aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/flash.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-21 18:09:28 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-21 18:09:28 +0000
commit658066225492589a157c4c4cc208257692732ba7 (patch)
treebf9d089a484d4af3b1a0ac2cad7eca584ea137ae /actionpack/lib/action_controller/flash.rb
parentd345b7a4f0b9fb957afa9fc1fcff0a50321a553d (diff)
downloadrails-658066225492589a157c4c4cc208257692732ba7.tar.gz
rails-658066225492589a157c4c4cc208257692732ba7.tar.bz2
rails-658066225492589a157c4c4cc208257692732ba7.zip
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
Diffstat (limited to 'actionpack/lib/action_controller/flash.rb')
-rw-r--r--actionpack/lib/action_controller/flash.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb
index 06c8c4b5c6..9eac5784fd 100644
--- a/actionpack/lib/action_controller/flash.rb
+++ b/actionpack/lib/action_controller/flash.rb
@@ -132,22 +132,31 @@ module ActionController #:nodoc:
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