我控制器的方法中的某部分:通行证到URL变量与轨渲染动作
***
else
@ord_question = @vq
render :action => :new, :layout => 'admin', :locals => {:order_question_id => @order_question_id}
end
所有的代码是在这里:
在我的新方法,之前我忘记输入一些字段并提交它(validator presence_of),我的网址是这样的:
...order_answers/new?order_question_id=15
但是我需要在url order_question_id = 15中保存这个get变量,即使在我使用render:action进入我的else方法之后。
我该如何添加渲染:action url param?
我想你应该重新考虑你传递'order_question_id'到表单操作的方式。我猜这里可以使用嵌套资源。 http://guides.rubyonrails.org/routing.html#nested-resources –
@MarekLipka它很长,重建,让我们来做这个问题... – brabertaser19