Rails はselect_tag
デフォルトで name 引数から id と name を生成します:
select_tag "people", "<option>David</option>".html_safe
# => <select id="people" name="people"><option>David</option></select>
しかし、 and属性select
なしで生成したい場合はどうなるでしょうか? id
name
このような:
<select><option>David</option></select>
空の name 引数は機能しません。空の html 属性がまだ存在します:
select_tag "", "<option>David</option>".html_safe
# => <select id name><option>David</option></select>
手動id
とname
割り当てが機能しない
select_tag "people", "<option>David</option>".html_safe, id: false, name: false
# => <select id=false name=false><option>David</option></select>
select_tag "people", "<option>David</option>".html_safe, id: '', name: ''
# => <select id name><option>David</option></select>