这是我要为特定值更改的选择标签:
<div class="select_field">
<%= select_tag
"quote[service_id]",options_for_select(AvailableService.all.map { |u|
[u.service_type.titleize+" - "+ (u.service_name == "housekeeping" ?
"House cleaning" : u.service_name), u.id] }), { prompt: "Select
Service", required: true } %>
</div>
答案 0 :(得分:0)
您可以使用collection_select
<%= collection_select :service_id, AvailableService.where(service_type:"cleaning"),
:id, :service_name, {}, {prompt:"Select Service", required: true} %>