0
votes

I've generated some resources via scaffold, and see <p id="notice"><%= notice %></p> at the top of index and show views.

I have searched for all occurrences of this across the app and deleted them (so there are no flash messages).

Then, I added this to application.html.erb

<% if notice %>
  <p class="alert alert-success"><%= notice %></p>
<% end %>
<% if alert %>
  <p class="alert alert-danger"><%= alert %></p>
<% end %>

Will this effectively generate all possible flash messages?

The reason I ask is because I believe bootstrap has >2 types of messages (e.g. "success", "danger", "info", "primary", "secondary", "warning", "light", "dark"), yet the above code seems to only cater to 2.

For reference, the added code comes from here

1

1 Answers

0
votes

Devise just uses notice and alert. If you want more, just add it as described here. If you add warning, like in the docs, you can add:

<% if warning %>
  <p class="alert alert-warning"><%= warning %></p>
<% end %>

and so on.