app/views/cats/edit.html.erb
<h2>Edit <%= @cat.name %></h2>
<%= form_for(@cat) do |f| %>
<div class="field">
<%= f.label :bio %><br>
<%= f.text_area :bio%>
</div>
<div class="field">
<%= f.label :birthday_date %><br>
<%= f.date_field :birthday_date %>
</div>
<div class="field">
<%= f.label :gender %><br>
<%= f.select(:gender, [['Male', :male], ['Female', :female]], :prompt => 'Select') %>
</div>
<div class="field">
<%= f.label :sterilized %><br>
<%= f.select(:sterilized, [['Yes', :yes], ['No', :no]], :prompt => 'Select') %>
</div>
<div class="field">
<%= f.label :abandoned_date %><br>
<%= f.date_field :abandoned_date %>
</div>
<div class="field">
<%= f.label :document %><br>
<%= f.text_field :document %>
</div>
<div class="field">
<%= f.label :colony_id %><br>
<%= f.select(:colony_id, Colony.all.collect {|u| [u.name, u.id]}, :prompt => 'Select') %>
</div>
<div id="sufferings field">
<%= f.fields_for :sufferings do |ff| %>
<div class="card" style="width: 18rem;">
<div class="card-body">
<%= ff.label :status %><br/>
<%= ff.select :status, Suffering.statuses.keys.map { |w| [w.humanize, w] } %> <br/>
<%= ff.hidden_field :cat_id, params[:cat_id] %>
<%= ff.label "Illness" %><br/>
<%= ff.collection_select(:illness_id, Illness.all, :id, :name ) %><br/>
<%= ff.check_box :chronic %>
<%= ff.label :chronic %>
<%= ff.label :diagnosis_date %><br>
<%= ff.date_field :diagnosis_date, class: 'form-control' %>
<%= ff.label :notes %><br>
<%= ff.text_area :notes, class:'form-control' %><br/>
<%= ff.check_box :_destroy %>
<%= ff.label :_destroy, "Remove" %>
</div>
</div>
<% end %>
<div class="links">
<%= link_to_add_association f, :sufferings, class:'btn btn-primary' do %>Add<% end %>
</div>
</div>
<br/>
<div class="actions">
<%= f.submit %>
</div>
<% end %>