rootstrap/rails_hotwire_base

View on GitHub
app/views/shared/_error_messages.html.erb

Summary

Maintainability
Test Coverage
<% if resource.errors.any? %>
  <div class="flex flex-col bg-red-100 text-red-700 px-4 py-3 rounded" id="error_explanation">
    <h2 class="font-semibold">
      <%= I18n.t("errors.messages.not_saved",
                 count: resource.errors.count,
                 resource: resource.class.model_name.human.downcase)
       %>
    </h2>
    <ul class="list-disc list-inside">
      <% resource.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
    </ul>
  </div>
<% end %>