Ruby on rails Rails窗体按钮没有';不要做我期待的情人

Ruby on rails Rails窗体按钮没有';不要做我期待的情人,ruby-on-rails,ruby,forms,Ruby On Rails,Ruby,Forms,我一直在使用收音机提交我的表格,但决定切换到使用普通按钮。但是我的表单没有像我的strong_参数所期望的那样在我的参数中设置通常的key:value对 我拥有的Params,我期待着新的形式: { "utf8"=>"✓", "_method"=>"patch", "model_name" => { "event"=>"university_decided" }, "university_decision"=>"university_accept

我一直在使用收音机提交我的表格,但决定切换到使用普通按钮。但是我的表单没有像我的
strong_参数
所期望的那样在我的参数中设置通常的
key:value

我拥有的Params,我期待着新的形式:

{  "utf8"=>"✓", 
  "_method"=>"patch", 
  "model_name" => { "event"=>"university_decided" }, 
  "university_decision"=>"university_accepted", 
  "controller"=>"unis", 
  "action"=>"update", 
  "id"=>"5"
}
但我得到的却是:

{  "utf8"=>"✓", 
  "_method"=>"patch", 
  "event"=>"university_decided" , 
  "university_decision"=>"university_accepted", 
  "controller"=>"unis", 
  "action"=>"update", 
  "id"=>"5"
}
在分部外部使用表单的原始分部:

  %p.material-font-title
    %em What did the university decide?

  .radio
    = f.label :university_decision_university_accepted do
      = f.radio_button :university_decision, "university_accepted"
      Accepted
  .radio
    = f.label :university_decision_university_declined do
      = f.radio_button :university_decision, "university_declined"
      Declined
  = f.button "Mark university decided",
    value: "event_name",
    name: "event",
    class: "btn btn-ghost-info"
这是我在一个部分中的新表单:

= form_for model_name do |f|
  = hidden_field_tag "event", "event_name"

  %p.material-font-title
    %em What did the university decide?

  = f.button "Accepted",
    value: "university_accepted",
    name: "university_decision",
    class: "btn btn-default"
正在从控制器视图调用的:

 = render "#{path}/university_decision", model_name: @model

这实际上是一个非常简单的解决方案,我忘记了我可以定义嵌套名称。因此,按钮将如下所示,以使我的参数正确显示:

  = f.button "Accepted",
    value: "university_accepted",
    name: "model_name[university_decision]",
    class: "btn btn-default"

form\u for model\u name
应该是
form\u for
它是,这是一个partial和I pass模型对象,其中您是否在routes中为此模型创建了命名空间路由。rb您希望参数中有什么?如果它的
事件
,它将不会作为模型参数出现,因为您将它作为
标记
否,事件按我的要求工作。我的问题是
{university\u决策:“university\u accepted”
应该在
模型名称中:
,但它不是