RoR Routes Error: From a link_to built URL, route appears in rake routes
routes.rb
resources :project_associations, :only => [:update]
rake routes
project_association PUT /project_associations/:id(.:format) {:action=>"update", :controller=>"project_associations"}
ERB
<%= link_to membership_command[:text], project_association_path(membership_command[:id], :command => membership_com开发者_JAVA技巧mand[:command])%>
Resulting HTML
<a href="/project_associations/2011?command=suspend">Suspend</a>
Click result: Routing Error No route matches "/project_associations/2011"
I kicked the server, same result
Thanks in advance for any assistance.
Add this to the link_to
: :method => :put
.
So:
<%= link_to membership_command[:text], project_association_path(membership_command[:id], :command => membership_command[:command]), :method => :put %>
精彩评论