Reputation: 3888
I have these routes from running 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
I have this link_to
in my view:
= link_to "Update", controller: "workstations", method: "put"
Yet I'm getting this error:
No route matches {:controller=>"workstations", :method=>"put"}
Have I not specified for the link to use the workstations
controller with the put
method, which should, in theory, lead to the workstations#update
action?
Upvotes: 0
Views: 40
Reputation: 3475
I think you want the following:
= link_to "Update", workstations_path, :method => :put
And it looks like you generated a singular resource in your routes.rb... was that intentional?
Upvotes: 0
Reputation: 5734
Try with
= link_to "Update", edit_workstations_path, :method => :put
OR
= link_to "Update", '/workstations', :method => :put
Upvotes: 1