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