Ruby on rails Rails从单一表单保存数据关联模型

Ruby on rails Rails从单一表单保存数据关联模型,ruby-on-rails,model,model-associations,Ruby On Rails,Model,Model Associations,我有三张桌子 User(id,email) Client_Org(id,name) Role(id,user_id,client_org_id,role) role:default "CD" 表单添加新的客户组织 = form_for(@client_org,remote: true) do |f| .post_errors .form_add_email =f.label :"Name of Client Organization" =f.text_field

我有三张桌子

User(id,email)
Client_Org(id,name)
Role(id,user_id,client_org_id,role) role:default "CD"
表单添加新的客户组织

= form_for(@client_org,remote: true) do |f|
   .post_errors
   .form_add_email
     =f.label :"Name of Client Organization"
     =f.text_field :name ,:autofocus => true ,class: "input_name",placeholder: "Name"
     %br
     =f.fields_for(:user) do |uf|
       =uf.label :email
       =uf.text_field :email,:autofocus => true ,class: "input_email"
     .btn_form_add
       = button_tag "Cancel", type: :button, id: "cancelForm", class: "btn"
       = f.submit "Add Another Organization", :name => "add_another_org"
       = f.submit "Done", :name => 'done'
提交表单时的参数:客户组织[名称],客户组织[用户][电子邮件]

当管理员提交上述表单时。我想将数据保存到3个表中


如何操作?

使用
接受
的嵌套属性