Mel
Mel

Reputation: 2715

Rails 4 - Simple Form - how to get rid of the label

I'm trying to figure out how to use simple form without the pre-determined label.

I've tried setting label to false as set out below, but it doesn't stop the label of the attribute ('trl') from appearing beside the collection.

<%= f.input :trl do %>
    <%= f.select :trl, Trl.all.map { |t| [t.title, t.id] }, label: false,  include_blank: false, prompt: 'Select one' %>
    <% end %>

Is there a way to dis-apply the labels in simple form?

Upvotes: 1

Views: 48

Answers (1)

dp7
dp7

Reputation: 6749

try this:

<%= f.input :trl, label: false do %>
  <%= f.select :trl, Trl.all.map { |t| [t.title, t.id] },include_blank: false, prompt: 'Select one' %>
<% end %>

Upvotes: 2

Related Questions