Since I’ve started programming in Rails 5 days ago. I’m learning very many aspects of the framework by seeing its behaviour around my tests, the answers were perfect but this time I’ve got this one and I dont know what to do with it:
The message that I’ve got is this one…
undefined method `task_task_task_task_task_path’ for #<#:0x36df6c8>
This is my view:
<%= form_for @tasks do |t| %>
<div id="task_list">
<% @tasks.each do |task| %>
<li id="task">
<% if task.done == false %>
<%= t.check_box :done, :checked => task.done, :checked_value => true, :unchecked_value => false %> <%= task.name %>
<% else %>
<%= t.check_box :done, :checked => task.done, :checked_value => true, :unchecked_value => false, :disabled => "disabled" %> <%= task.name + "(done)" %>
<% end %>
</li>
<% end %>
<%= t.submit "Mark selected as done", :action => "update" %>
</div>
<% end %>
I’ve already checked the form and submit documentation many times but I can’t get it. This form is for many instances and update every instance with a new boolean value.
Thanks already.
You can’t magically submit an array of data to a server, Rails form helpers are for individual objects, not for collections.
There are ways, however, to submit an array of values back to the server,for example you can append [] to checkbox name attribute, this will force rails to create an array of values on server side.
For a detailed discussion, please see this documentation point 7.1