cookiescope with some added functionality. It is cleared at the end of the next page that the user views. This means that it's a good fit for storing messages or variables temporarily from one request to the next.
editaction. Please note that this is done on the next request since we performed a redirect after setting the Flash.
success, but it could have been anything that we wanted. Just like with a normal struct, the naming of the keys is your job.
error, and another one for storing messages after a successful user operation, called
successargument coming in and knows that it's not part of its own declared arguments.
flashInsert(success="The user was updated successfully.")for you behind the scenes.
editaction and set a key in the Flash named
actionas well? Simply prepend the key with
flashto tell Wheels to avoid the argument naming collision.
action, but these naming collisions can potentially happen when you want to redirect to a route that takes custom arguments, so remember this workaround.
classattributes set similarly (
key/keysargument to limit its reach to a list of given keys. Let's say that we only want our layout to show messages for the
alertkey but not for the
successkeys (or any other for that matter). We would write our call like so:
sessionscope. You can find out where Wheels stores the Flash data in your application by outputting
get("flashStorage"). If you have session management enabled in your application, Wheels will default to storing the Flash in the
sessionscope. Otherwise, it will store it in a cookie on the user's computer.
sessionscope, you need to make sure that session management is enabled. To enable it, all you need to do is add
this.SessionManagement = trueto the
sessionscope. Users could open their cookie file up and manually change its value. Sessions are stored on the server, out of users' reach.
set(flashAppend=true), you can also directly pass in an array of strings like so:
cookieas a viable route. But if set to
cookie, you always get
Set-Cookiebeing returned, which is unnecessary.
set(flashStorage = "none")which will prevent the creation of the cookie, and also not try and write to a session.