You can show messages using
flash. A flash message is a simple String that is
passed between two actions. This is used for notifying the user an action was a success
or failure. (e.g. “Record was saved successfully”)
The built in messages types are
info. Using these
will cause compile time errors if you accidentally mistype something. It is
recommended to stick to these whenever possible.
# In an action flash.success = "It worked!" flash.failure = "That did not work" flash.info = "Be cool"
These will be rendered by the flash component in
src/components/shared/flash_messages.cr. The flash component is called from
AuthLayout (found in
src/pages/) by the
You can modify the layout or the component to add HTML classes, change where flash is rendered, etc.
The built in messages are
info, but you can use anything
flash.set("something_special", "Super spesh") flash.get("something_special") # => "Super spesh"