我有这些路线来自rake routes
:
workstations POST /workstations(.:format) workstations#create
new_workstations GET /workstations/new(.:format) workstations#new
edit_workstations GET /workstations/edit(.:format) workstations#edit
GET /workstations(.:format) workstations#show
PUT /workstations(.:format) workstations#update
DELETE /workstations(.:format) workstations#destroy
POST / workstations#delete_history_and_queue
我认为我有link_to
:
= link_to "Update", controller: "workstations", method: "put"
然而我收到了这个错误:
No route matches {:controller=>"workstations", :method=>"put"}
我是否未指定将workstations
控制器与put
方法一起使用的链接,理论上这应该导致workstations#update
操作?
答案 0 :(得分:1)
尝试
= link_to "Update", edit_workstations_path, :method => :put
OR
= link_to "Update", '/workstations', :method => :put
答案 1 :(得分:0)
我想你想要以下内容:
= link_to "Update", workstations_path, :method => :put
看起来你在你的路线中生成了一个奇异的资源.rb ......是故意的吗?