gpt4 book ai didi

ruby-on-rails - RoR Routes 错误 : From a link_to built URL, 路由出现在 rake 路由中

转载 作者:行者123 更新时间:2023-12-04 06:12:45 26 4
gpt4 key购买 nike

路线.rb

resources :project_associations, :only => [:update]

rake 路

project_association PUT    /project_associations/:id(.:format)  {:action=>"update", :controller=>"project_associations"}

再培训局

<%= link_to membership_command[:text], project_association_path(membership_command[:id], :command => membership_command[:command])%>

生成的 HTML

<a href="/project_associations/2011?command=suspend">Suspend</a>

点击结果:路由错误没有路线匹配“/project_associations/2011”

我踢了服务器,同样的结果

在此先感谢您的帮助。

最佳答案

将此添加到 link_to::method => :put

所以:

    <%= link_to membership_command[:text], project_association_path(membership_command[:id], :command => membership_command[:command]), :method => :put %>

关于ruby-on-rails - RoR Routes 错误 : From a link_to built URL, 路由出现在 rake 路由中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7541537/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com