Rails如何在表单的输入字段中创建参数?

时间:2019-04-25 12:37:55

标签: ruby-on-rails

我正在使用一些Vue组件来创建Rails表单。 在我的Vue组件中,我有一个隐藏字段:

<input :value="selectedId" :name="name" :id="name" >

值是“ 1”,“ 2”。

这些是我的多重选择中选择的IDS。

名称是content[brand_ids]

当我提交表格时,这些是我的参数:

  

“✓”,“ _ method” =>“补丁”,“ authenticity_token” =>“ cCG + YU0AwizJ88L0yBYnnbEnv10Z0DpJNtl35gNDauNVUjDxdqQafMiNLMT4gVQBg43Ed4LNyCV = Z =”“”“ ,“名称” =>“”,“永久链接” =>“”,“ author_id” =>“ 1”,“ additional_author_ids” => [“”],“ published_at” =>“ 25/04/2019 13:33 “,” brand_ids“ => [” \“ 1 \”,\“ 2 \”“],” section_ids“ => [”“],” main_image“ =>” https://via.placeholder.com/702x360“,” square_crop_img“ = >“ https://via.placeholder.com/360x280”,“摘要” =>“”,“ additional_html” =>“”,“源名称” =>“”,“源链接” =>“”,“表示” =>“标准”, “ major_label_ids” => [“”],“ not_in_home” =>“ 0”,“ sponsored” =>“ 0”,“ no_adv” =>“ 0”,“ sponsorship_attributes” => {“ sponsor” =>“” ,“ color” =>“#e25000”,“ duration” =>“”},“ live_blog_attributes” => {“ live_blog_id” =>“”,“ status” =>“ inactive”}},“ remove _” => “ 1”,“ stringy_video_ids” =>“”,“ commit” =>“ Salva bozza”,“ controller” =>“ admin / contents”,“ action” =>“ update”,“ id” =>“ 33” }允许:false>

您可以看到我的值“ 1”,“ 2”,

"brand_ids"=>["\"1\",\"2\""]

作为数组中的唯一字符串传递。

为什么?

0 个答案:

没有答案