如何根据需要设置f.select字段?
:required => true
无效
<div class="form-group">
<label>Bedrooms</label>
<%= f.select :bed_room, [["1",1], ["2",2], ["3",3], ["4",4], ["5",5], ["6",6], ["7",7], ["8",8], ["9",9], ["10+",10]], prompt: "Select...", class: "form-control", :required => true %>
</div>
事先提前
答案 0 :(得分:1)
它就像一个魅力:
<%= f.select :bed_room, [["1",1], ["2",2], ["3",3], ["4",4], ["5",5], ["6",6], ["7",7], ["8",8], ["9",9], ["10+",10]], { prompt: "Select..." }, { class: "form-control", required: true } %>