开发者

RoR Routes Error: From a link_to built URL, route appears in rake routes

开发者 https://www.devze.com 2023-04-08 17:40 出处:网络
routes.rb resources :project_associations, :only => [:update] rake routes project_association PUT/project_associations/:id(.:format){:action=>\"update\", :controller=>\"project_associatio

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 %>
0

精彩评论

暂无评论...
验证码 换一张
取 消