<%= form_with(model: product) do |form| %> <% if product.errors.any? %> <div style="color: red"> <h2><%= pluralize(product.errors.count, "error") %> prohibited this product from being saved:</h2> <ul> <% product.errors.each do |error| %> <li><%= error.full_message %></li> <% end %> </ul> </div> <% end %> <div class="mb-3"> <%= form.label :name, class: 'form-label' %> <%= form.text_field :name, class: 'form-control' %> </div> <div class="mb-3"> <%= form.label :price, class: 'form-label' %> <%= form.text_field :price, class: 'form-control' %> </div> <div class="actions"> <%= form.submit class: 'btn btn-primary' %> </div> <% end %>