I know that there must be a really simple solution to the below problem but I have been trying to work it out for the last few hours.
I’m trying to update a table when a checkbox is checked (using ajax).
<% @tasks.each do |task| %>
<tr><td>
<%= form_for task, :url => {:controller =>"tasks", :action => "update" }, :remote =>true do |t| %>
<%= t.check_box :completed_at, :class => 'submittable'%>
<% end %>
</td><td>
<h3><%=task.description %></h3></td>
<td><%= link_to 'Edit Task',edit_list_task_path(@list, task), :id => "edit_#{task.id}",:class=>"btn info" %></td>
<td><%= link_to 'Delete Task', list_task_path(@list, task), :method => :delete, :confirm => "Are you sure?", :id => "delete_#{task.id}", :class=>"btn danger "%></td></tr></tr>
<%end%>
However I’m getting the following routing error:
No route matches {:controller=>"tasks", :action=>"update"}
My current routing file looks like this:
root :to => "home#index"
resources :documents
resources :timelines
resources :lists
resources :tasks
resources :fundraisings
resources :news
get "home/index"
devise_for :users, :lists, :fundraisings, :timelines
resources :lists do
resources :tasks
end
resources :users do
resources :lists
end
Any idea why?
With standard RESTful routing you don’t need to specify the url. Does this not work?