Ask A Question

Notifications

You’re not receiving notifications from this thread.

How to handle flash messages with TurboJS?

Johan André asked in Gems / Libraries

When using turbo-frame to switch from showing a partial of model to showing the form of model, how do I handle flash messages?
The failed state - for failed validation - is pretty straight forward, since I re-render the form and outlining the validation errors in the form. But when a form is successfully submitted I would like to show a message (preferably like a toast) saying the data is saved.

Any ideas how to do that in a clean way?

Reply

You can use a turbo stream to insert the flash message into a div for them. 👍

I'm actually going to do a screencast on this shortly.

Reply

Ahhh! Nice. Thanks!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.