The flash object in Rails

In Rails Guides it says:

The flash is a special part of the session which is cleared with each request. This means that values stored there will only be available in the next request, which is useful for passing error messages etc.

This is not entirely ture. If you don’t access the the flash object in the next request. The message will be carried on.

This is more clear from the code. The message will be marked for discard upon access.

  def []=(k, v)
    k = k.to_s
    @flash[k] = v
    @flash.discard(k)
    v
  end