I have a code that generates a form for me:
<%= form_for(@member) do |f| %>
<%= f.label :email %>
<%= f.text_field :email %>
<% end %>
I would like to customize the label for this field, ie. set a non-default one.
How would I do that?
You could be tempted to replace f.label :email
with f.label "whatever"
, but this'll put you in troubles: you won't be able to use your label for quick access to your text field by clicking on the label's area. Make it this way:
<%= f.label :email, "Something" %>
You text field and label will be associated, but the last one just will be having a different representation a page.
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