diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-07 06:11:56 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-07 06:11:56 +0000 |
commit | 2399a223c35622178ea58db6629cfd26f2230d60 (patch) | |
tree | 5a3c5fc32560643eb042631a3f23f357eb74ca09 /actionpack/lib/action_controller/flash.rb | |
parent | 2bf8f2307e3f13a7b6cf703cdb954cc9a3f5244d (diff) | |
download | rails-2399a223c35622178ea58db6629cfd26f2230d60.tar.gz rails-2399a223c35622178ea58db6629cfd26f2230d60.tar.bz2 rails-2399a223c35622178ea58db6629cfd26f2230d60.zip |
Deprecation! @session and @flash will be removed after 1.2. Use the session and flash methods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4699 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/flash.rb')
-rw-r--r-- | actionpack/lib/action_controller/flash.rb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb index 623ce2f4ba..a166c1060c 100644 --- a/actionpack/lib/action_controller/flash.rb +++ b/actionpack/lib/action_controller/flash.rb @@ -17,7 +17,7 @@ module ActionController #:nodoc: # end # # display.rhtml - # <% if @flash[:notice] %><div class="notice"><%= @flash[:notice] %></div><% end %> + # <% if flash[:notice] %><div class="notice"><%= flash[:notice] %></div><% end %> # # This example just places a string in the flash, but you can put any object in there. And of course, you can put as many # as you like at a time too. Just remember: They'll be gone by the time the next action has been performed. @@ -141,13 +141,13 @@ module ActionController #:nodoc: end def process_cleanup_with_flash - flash.sweep if @session + flash.sweep if @_session process_cleanup_without_flash end def reset_session_with_flash reset_session_without_flash - remove_instance_variable(:@flash) + remove_instance_variable(:@_flash) flash(:refresh) end @@ -156,20 +156,19 @@ module ActionController #:nodoc: # <tt>flash["notice"] = "hello"</tt> to put a new one. # Note that if sessions are disabled only flash.now will work. def flash(refresh = false) #:doc: - if !defined?(@flash) || refresh - @flash = - if @session.is_a?(Hash) - # @session is a Hash, if sessions are disabled - # we don't put the flash in the session in this case + if !defined?(@_flash) || refresh + @_flash = + if session.is_a?(Hash) + # don't put flash in session if disabled FlashHash.new else - # otherwise, @session is a CGI::Session or a TestSession + # otherwise, session is a CGI::Session or a TestSession # so make sure it gets retrieved from/saved to session storage after request processing - @session["flash"] ||= FlashHash.new + session["flash"] ||= FlashHash.new end end - - @flash + + @_flash end # deprecated. use <tt>flash.keep</tt> instead |