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

      <ul>
        <%% <%= singular_table_name %>.errors.each do |error| %>
          <li><%%= error.full_message %></li>
        <%% end %>
      </ul>
    </div>
  <%% end %>
<% attributes.each do |attribute| -%>
  <div class="mb-3<%= attribute.type == :boolean ? ' form-check' : '' -%>">
<% if attribute.password_digest? -%>
    <%%= form.label :password, class: 'form-label' %>
    <%%= form.password_field :password, class: 'form-control' %>
  </div>

  <div class="mb-3">
    <%%= form.label :password_confirmation, class: 'form-label' %>
    <%%= form.password_field :password_confirmation, class: 'form-control' %>
<% elsif attribute.type == :boolean -%>
    <%%= form.label :<%= attribute.column_name %>, class: 'form-check-label' %>
    <%%= form.check_box :<%= attribute.column_name %>, class: 'form-check-input' %>
<% elsif attribute.attachments? -%>
    <%%= form.label :<%= attribute.column_name %> %>
    <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true %>
<% else -%>
    <%%= form.label :<%= attribute.column_name %>, class: 'form-label' %>
    <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %>
<% end -%>
  </div>

<% end -%>
  <div class="actions">
    <%%= form.submit class: 'btn btn-primary' %>
  </div>
<%% end %>