Ruby on rails 轨道形成动作缺少路线
Ruby 1.9.3并使用HAML 试图构建一个表单以转到特定操作,但在路由方面遇到问题。表格上的代码是Ruby on rails 轨道形成动作缺少路线,ruby-on-rails,ruby,forms,Ruby On Rails,Ruby,Forms,Ruby 1.9.3并使用HAML 试图构建一个表单以转到特定操作,但在路由方面遇到问题。表格上的代码是 %form#feedback_form{:action=>"give_feedback_account_path", :method => 'post', :style => "padding: 0 5px;"} %input{:name => "authenticity_token", :value => form_authenticity_token,
%form#feedback_form{:action=>"give_feedback_account_path", :method => 'post', :style => "padding: 0 5px;"}
%input{:name => "authenticity_token", :value => form_authenticity_token, :type => "hidden"}
blah blah blah
.field
%input#feedback_submit{:type => "submit", :value => "give feedback"}
当我尝试提交表单时,我得到了404响应,查看服务器日志会得到
Started POST "/give_feedback_account_path" for 127.0.0.1 at 2014-06-03 10:07:12 +0100
ActionController::RoutingError (No route matches "/give_feedback_account_path"):
当我运行rake routes以获取详细信息时
give_feedback_account POST /account/give_feedback(.:format)
{:action=>"give_feedback", :controller=>"accounts"}
我缺少什么?你的url是
/give\u feedback\u account\u path
,这不好。要修复它,可以使用帮助器:
改变这个
:action=>"give_feedback_account_path"
对此
:action => give_feedback_account_path
提供反馈、说明、路径是一种方法。您想调用它,以获取实际路径。@GarethBurrows它有帮助吗?
:action => give_feedback_account_path