Pass variable to Flash object
I'm trying to pass a variable to flash messages object. I want to autohide flash messages(not each message) after 5 seconds in Stimulus controller. So I want to be able to set data-flash-autohide-value="true or false" in HTML.
One thing that I'm not sure how to pass this true or false from controller?
redirect_to some_path, notice: "Some message", autohide: true - this is clearly not working
so I can pass that variable in HTML stimulus value
You can use html_safe on the notice message to allow them to include HTML.
redirect_to some_path, notice: "<div data-controller=\"autohide\">Some message</div>"