开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜