这是访问 requests/index.html.erb 时的问题:
路由错误
没有路由匹配 {:action=>"cancel", :controller=>"requests"}
index.html.erb:
<%= link_to "Cancel", cancel_request_path %>
路线.rb:
resources :requests do
get 'cancel', on: :member
end
requests_controller.rb:
def cancel
request = Request.find(params[:id])
request.update_attributes(stage: "Cancelled")
redirect_to root_path
end
我错过了什么?