私はこれを単純な形で持っています:
= simple_form_for(Note.new, remote: true) do |f|
= f.collection_select :dance_id, current_user.dances.includes(:style).all,
:id, :style_name, {prompt: "Please select dance"}, {class: "form-control"}
生成されたコード:
<select class="form-control" name="note[dance_id]" id="note_dance_id">
<option value="">Please select dance</option>
<option value="39">Adowa Dance (Ghana)</option>
<option value="38">Adowa Dance (Ghana)</option>
<option value="37">Tango (Argentina)</option>
</select>
私が望むようにstyle_nameですべてのダンスを表示しているので、うまくいきます。しかし、同じスタイルの同じ名前のダンスがたくさんあるので、コレクション内の各ダンスのすぐ隣にレベルと日付を表示したいと思います。助けてください。シンプルなフォームヘルパーでそれを行うより良い方法はありますか?