我知道對於下面的問題一定有一個非常簡單的解決方案,但我一直試圖在最近幾個小時內解決它。Rails 3:嘗試執行ajax複選框時的路由問題
我想更新一個表格,當選中複選框(使用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%>
但是我得到以下路由錯誤:
No route matches {:controller=>"tasks", :action=>"update"}
我當前的路由文件看起來像這樣:
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
任何想法,爲什麼?