The flash plugin adds a flash instance method, for typical web application flash handling, where values set in the current flash hash are available in the next request loading the flash.
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
You can modify the flash for the current request (instead of the next request) by using the flash.now method:
r.get do flash.now['a'] = 'b' flash['a'] # = >'b' end
The flash is saved in the session, so it has the same restrictions as other data saved in the session. If the session does not support symbols (e.g. when using the sessions plugin), you should not use symbols as flash keys.
Classes and Modules
Constants
| SCOPE_INSTANCE_VARIABLES | = | [:@_flash].freeze |