<%= select_tag(:services, options_from_collection_for_select(Service.all, :id, :name))%>
And it displays all the services...
But I want it to be something like:
Select a service Service1 Service2 Service3 Service4
Most of the time, you don't want to append anything to the array directly; either of these is a cleaner solution:
:prompt => "Placeholder"
if you want the placeholder to show up only when the attribute is nil at the time the form is rendered. It will be selected by default, but nothing will be saved if user submits. If the attribute is already populated [possibly because a) there's a default value or b) it's an edit form], the placeholder item will be omitted from the list entirely.:include_blank => "Placeholder"
if you want to include the placeholder in the rendered list at all times.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With