1
基本上我有這種形式:Rails的:多選擇框語法
<%= builder.select(:song_id, options_for_select(@selections.sort!), {}, {multiple: true, size: 7}) %>
其中在HTML中呈現這樣的:
<input name="allocation[song_id][]" type="hidden" value="" />
<select id="allocation_song_id" multiple="multiple" name="allocation[song_id][]" size="7">
基本上我很好奇,其中第二數組括號(allocation[song_id]**[]**)
來自於,因爲我認爲它影響了我的論據傳遞的方式(歌曲ID在表單提交時保持默認第一首歌曲)。任何指針將不勝感激。