Module: Roda::RodaPlugins::Flash

Defined in:
lib/roda/plugins/flash.rb

Overview

The flash plugin adds a flash instance method to Roda, for typical web application flash handling, where values set in the current flash hash are available in the next request.

With the example below, if a POST request is submitted, it will redirect and the resulting GET request will return ‘b’.

plugin :flash

route do |r|
  r.is '' do
    r.get do
      flash['a']
    end

    r.post do
      flash['a'] = 'b'
      r.redirect('')
    end
  end
end

Defined Under Namespace

Modules: InstanceMethods Classes: FlashHash

Constant Summary collapse

KEY =

The internal session key used to store the flash.

:_flash