HeavyTechRuby/history

View on GitHub
app/views/stories/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_with(model: story) do |form| %>
  <% if story.errors.any? %>
    <div style="color: red">
      <h2><%= pluralize(story.errors.count, "error") %> prohibited this story from being saved:</h2>

      <ul>
        <% story.errors.each do |error| %>
          <li><%= error.full_message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <div class="row mb-3">
    <%= form.label :address, style: "display: block", class: "form-label" %>
    <%= form.text_field :address, class: "form-control" %>
  </div>

  <div class="row mb-3">
    <%= form.label :body, style: "display: block", class: "form-label" %>
    <%= form.rich_text_area :body %>
  </div>

  <%= form.submit class: "btn btn-primary mb-3" %>
<% end %>