2013-09-24 74 views
0

我從運行rake routes這些航線的航班:爲什麼不`link_to`去我指定

 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操作?

回答

1

嘗試用

= link_to "Update", edit_workstations_path, :method => :put 

OR

= link_to "Update", '/workstations', :method => :put 
0

我想你想以下幾點:

= link_to "Update", workstations_path, :method => :put 

它看起來像你產生在你的routes.rb單一資源。 ..是故意的嗎?

相關問題