Vote count: 0
From the Using Ajax and jQuery in Rails 5 Apps tutorial and given the following view and partial:
app/views/tasks/index.html.erb:
<%= link_to "New Task", new_task_path, id: "new_link" %>
Incomplete Tasks
<%= render @incomplete_tasks %>Complete Tasks
<%= render @complete_tasks %>app/views/tasks/_task.html.erb:
<%= form_for task do |f| %>
<%= f.check_box :complete %>
<%= f.submit "Update" %>
<%= f.label :complete, task.name %>
<%= link_to "(remove)", task, method: :delete, data: {confirm: "Are you sure?"} %>
<% end %>
The problem is clicking on any element only selects the first item (shown below) which makes me think the partial is being rendered incorectly.
Looking through the rails guide about rendering collection I wasn't able to find the answer.
Why isn't the <%= f.label :complete, task.name %> line working as expected?
About to click on baz:
Clicking on baz expecting baz to get checked but instead foo gets checked:
asked 1 min ago
Rendering collection partial
Aucun commentaire:
Enregistrer un commentaire