Can I turn off the prompt for collection_select?

When I use:

<%= f.collection_select :parent_id, Parent.all, :id, :title, prompt: true %>

      

Rails then generates:

<select  name="child[parent_id]" id="child_parent_id">
  <option value="">Please select</option>
  <option value="1">Parent#1</option>
  ...
</select>

      

But I want to disable the prompt:

<option value="" disable>Please select</option>

      

Is there an attribute that turns it off?

I don't want to delete it. I want to turn it off

+3


source to share


1 answer


Remove the parameter prompt

and add include_blank: false

instead. It should remove the "Please select" option.



-1


source







All Articles