protected Method

InstanceMethods.flash(refresh = false)

Access the contents of the flash. Use flash["notice"] to read a notice you put there or flash["notice"] = "hello" to put a new one. Note that if sessions are disabled only flash.now will work.

Source Code

# File action_controller/flash.rb, line 149
def flash(refresh = false) #:doc:
  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
        # so make sure it gets retrieved from/saved to session storage after request processing
        session["flash"] ||= FlashHash.new
      end
  end

  @_flash
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.