DEV Community

austinmei5
austinmei5

Posted on

Notice and Alerts

Create 2 partials for notices and alerts:

<%= notice %>

<%= alert %>

We can also create a single partial and pass in the css_class:

<%= message %>

Logic in Application Layout:

  <% if notice.present? %>
    <%= render "shared/flash", message: notice, css_class: "success" %>
  <% end %>

  <% if alert.present? %>
    <%= render "shared/flash", message: alert, css_class: "danger" %>
  <% end %>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)