在我的Rails应用程序我有这个路线嵌套路线错误的Rails
resources :jobs do
resources :job_applications, :path => 'applications' do
member do
put :change_stage
end
end
end
而且我在job_application控制器的方法称为change_stage 其实,我试图改变job_application的一个PARAMS在模式所以为了这个,我有这样的模式身体
<%=form_for :job_application, :url => change_stage_job_job_application.(params[:application_status]), :html => {:method => :post, :class => 'form-horizontal' } do |f| %>
<%= label :status, 'reject' %>
<%= f.radio_button :application_status, 'reject' %><br>
<%= label :status, 'interview' %>
<%= f.radio_button :application_statuss, 'interview' %><br>
<%= label :status, 'hired' %>
<%= f.radio_button :application_status, 'hired' %>
<% end %>
,但我发现这个错误
undefined local variable or method `change_stage_job_application' for #<#<Class:0xb463b49c>:0xb463ac04>
什么是错误的,我的形式
什么,现在我得到这个错误是没有路由匹配{:动作=> “change_stage”:控制器=> “job_applications”:ID =>零,:JOB_ID =>零,:区域= >:en}缺少必需的键:[:id,:job_id] – rocki
绝对运行'rake routes',并确切地看到你需要用你的帮助器传递给控制器的参数。但从我所看到的,我非常肯定你需要传递'job_application'和'job'实例变量。你不需要传递'application_status',因为你可以通过控制器上的params散列获得这个值。 – josethernandezc