How to count the errors in the form

Hello,

IM doing this tutorial (Getting Started with Rails — Ruby on Rails Guides) and I like to make it a little better to show the errors when adding a comments to a article.

The orginal code given is this :

<h2>Add a comment:</h2>
<%= form_with model: [ @article, @article.comments.build ] do |form| %>
  <p>
    <%= form.label :commenter %><br>
    <%= form.text_field :commenter %>
  </p>
  <p>
    <%= form.label :body %><br>
    <%= form.text_area :body %>
  </p>
  <p>
    <%= form.submit %>
  </p>
<% end %>

but I wonder how to display any validations errors and how to count those errors,