vendredi 26 juillet 2019

Duplicated link_to button - Rails 5

Hi have the next problem:

I have an iteration over a model called JobApplication which has_many with JobApplicationWorkExperiences, also it saves the information as nested form and with this is point everything is ok.

In my view I have the following iteration

<% @job_application.job_application_work_histories.each do |work| %>
 <% if work.completed?
  <% link_to 'Edit', goes_to_my_path %>
 <% end %>
<% end %>

The Edit button is being show as many time there is a JobApplicationWorkExperience with the JobApplication id, what should I do to avoid this problem?

Thanks for your help.

Aucun commentaire:

Enregistrer un commentaire