Session::Flash
Inherits JSON::Serializable < Reference < Object
Flash provides temporary message storage that persists for exactly one request.
Messages added to next are available in now on the next request, then cleared.
Example usage:
In controller action (e.g., after login)
flash.next["notice"] = "Welcome back!"
In next request (e.g., dashboard view)
flash.now["notice"] # => "Welcome back!"
For same-request messages (e.g., validation errors)
flash.now["error"] = "Invalid input"
Constructors
new(pull : JSON::PullParser)
Sourcenew
Sourcenew(*, __pull_for_json_serializable pull : JSON::PullParser)
SourceInstance methods
[]=(key : String, value : String) : String
Convenience method to set a flash message for next request
alert
Sourcealert=(message : String) : String
Sourceerror
Sourceerror=(message : String) : String
Sourceinfo
Sourceinfo=(message : String) : String
Sourcenotice=(message : String) : String
Sourcerotate!
Rotate flash messages: move next -> now, clear next Called automatically at start of each request
success
Sourcesuccess=(message : String) : String
Sourcewarning
Sourcewarning=(message : String) : String
Source