我需要表单来更新属于项目视图中的项目的任务并得到错误
No route matches [PATCH] "/projects/1/tasks/1/edit"
这是可用路线的列表
project_tasks_path GET /projects/:project_id/tasks(.:format) tasks#index
POST /projects/:project_id/tasks(.:format) tasks#create
new_project_task_path GET /projects/:project_id/tasks/new(.:format) tasks#new
edit_project_task_path GET /projects/:project_id/tasks/:id/edit(.:format) tasks#edit
project_task_path GET /projects/:project_id/tasks/:id(.:format) tasks#show
PATCH /projects/:project_id/tasks/:id(.:format) tasks#update
PUT /projects/:project_id/tasks/:id(.:format) tasks#update
DELETE /projects/:project_id/tasks/:id(.:format) tasks#destroy
projects_path GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project_path GET /projects/new(.:format) projects#new
edit_project_path GET /projects/:id/edit(.:format) projects#edit
project_path GET /projects/:id(.:format) projects#show
PATCH /projects/:id(.:format) projects#update
PUT /projects/:id(.:format) projects#update
DELETE /projects/:id(.:format) projects#destroy
projects_update_path POST /projects/update(.:format) projects#update
projects_add_path POST /projects/add(.:format) projects#add
POST /projects/:project_id/tasks/:id/edit(.:format) tasks#edit
root_path GET / projects#index
这是查看代码
<% @projects.each do |project| %>
<%= project.name %>
<% project.tasks.each do |task| %>
<%= task.name %></p>
<%= form_for [task.project, task], url: edit_project_task_path(task.project, task) do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.submit "Update task" %>
<% end %>
<% end %>
<% end %>