Ruby 提交表单后Rails ActiveAdmin设置值

Ruby 提交表单后Rails ActiveAdmin设置值,ruby,Ruby,我有一个表1的表格,它与表2有很多关系。 在app/admin/table1.rb中,我有: ActiveAdmin.register Table1 do . . . controller do def create . . . super end . . . end permit_params :xxx, . . .

我有一个表1的表格,它与表2有很多关系。 在app/admin/table1.rb中,我有:

ActiveAdmin.register Table1 do
.
.
.
controller do
  def create
      .
      .
      .
    super
  end
  .
  .
  .
end
permit_params :xxx,
               .
               .
               .
               table2_attributes: Table2::ATTRIBUTES,
form partial: "admin/accounts/shared/new_and_edit_form"
end
表2有attribute1、attribute2和attribute3,它们列在其模型文件的ATTRIBUTES常量中。在create&update方法中调用super之前,我需要将attribute3设置为true,但我不知道如何设置。我试过:

def create
  .
  .
  .
  table2_attr = params[:table1][:table2_attributes]
  if not table2_attr.nil?
    table2_attr.each do |attr|
      attr2[:attribute3] = true
    end
  end
  super
end
但是当我提交表单时,它说没有从符号到整数的隐式转换

如何设置该值?我也试着把f.input:attribute3作为::隐藏,但我也不知道如何在那里设置值。
谢谢

你能发布参数[:table1][:table2_attributes]的输出吗请{“0”=>{“attribute2”=>“2”}@Mark attribute1是table1的外键(它是table1的ID)