I’m populating my select box using the query shown below:
<%=f.select :acoustic, options_for_select(User.includes(:roles).where(
:roles => {:description => "Acoustic"}).collect{|u|[[u.name,u.surname].join(" ")]}) %>
However I want the default option for the select box to be an empty string. I’ve tried
<%=f.select :acoustic, options_for_select(["", User.includes(:roles).where(
:roles => {:description => "Acoustic"}).collect{|u|[[u.name,u.surname].join(" ")]}]) %>
But that doesn’t seem to work as the box is then populated by the blank space (as desired) but it only picks up the first result from the query and puts it into array brackets. Thanks in advance for any help
Try adding
:prompt => ' '. I think that will do what you want.