Get an array from a Rails form

后端 未结 5 1259
野趣味
野趣味 2021-01-12 13:10

I need to design a form for a account resource. In that form, i need to collect some set of ids as an array in the params hash in attribute called

5条回答
  •  灰色年华
    2021-01-12 14:10

    If you want to send array of values just use [] in name attributes.In your case just use

    <%= f.check_box "relationships", {}, :value => p.id, :name => "relationships[]"   %>
    

提交回复
热议问题