<!--
 Copyright 2017 Google, Inc

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<%= form_with(model: cat, local: true) do |form| %>
  <% if cat.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(cat.errors.count, "error") %> prohibited this cat from being saved:</h2>

      <ul>
      <% cat.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= form.label :name %>
    <%= form.text_field :name, id: :cat_name %>
  </div>

  <div class="field">
    <%= form.label :age %>
    <%= form.number_field :age, id: :cat_age %>
  </div>

  <div class="actions">
    <%= form.submit %>
  </div>
<% end %>
