Reputation: 498
I'm using Formtastic as a semantic_form_for books and lists. Each list has_many
books and each book belongs_to
a list. When the user creates a new book, they can choose what list to add the book to. Here is my form code:
<%= semantic_form_for(@book) do |f| %>
<p>Select a list to add this book to: </p>
<%= f.input :list, :as => :select %>
...
<%= f.submit "Add book", class: "btn btn-default" %>
<% end %>
The only problem is that the select tag that is generated has a blank option for select at the top. So the options for select look like this:
List 3
etc.
I don't want there to be an extra space. How can I fix that?
Here is a picture:
Upvotes: 0
Views: 140
Reputation: 135
I think what you're looking for is include_blank
. So it'd be something like this: <%= f.input :list, :as => :select, :include_blank => false %>
Upvotes: 1