I've just tried to create new nested items(candidates) with Cocoon gem. Currently views shows not create form but update form, how can I change form.
I want to try to show just create form.
<%= form_with(model: @title) do |f| %>
<%= f.fields_for :candidates do |candidate| %>
<div class="candidate-item">
<%= candidate.hidden_field :title_id, value: @title.id %>
<div class="field">
<label>Candidate</label>
<%= candidate.text_field :name%>
</div>
<div class="field file-field">
<label>Image</label>
<%= candidate.file_field :image, :type => "file" %>
</div>
</div>
<% end %>
I tried it like this:
form_with(model: @title, url: new_candidates_path but an undefined error occurs. Candidates nested for titles. Please let me know any ideas which shows not update form, create form.