From 2399a223c35622178ea58db6629cfd26f2230d60 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 7 Aug 2006 06:11:56 +0000 Subject: 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 --- actionpack/lib/action_controller/flash.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'actionpack/lib/action_controller/flash.rb') 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] %>
<%= @flash[:notice] %>
<% end %> + # <% if flash[:notice] %>
<%= flash[:notice] %>
<% 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: # flash["notice"] = "hello" 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 flash.keep instead -- cgit v1.2.3