We've been using a custom :warning flash type beyond Rails' default :notice and :alert, but passing it was cumbersome, had to put it in flash manually, the common way of just passing a key to redirect_to like redirect_to(root_path, warning: "Try again!") did not work.
Turns out you can define custom flash types and have Rails expose the convenience keys automagically.
class ApplicationController < ActionController::Base
add_flash_types :warning
Top comments (0)