f.text_field(:user_id, value: 'user id')
is generating label tag
<label class="control-label">User</label>
How can I generate
<label class="control-label">User Id</label>
from text_field
helper
尝试这个:
= f.text_field(:user_id, label: 'User Id')
This also should work
<%= f.label :user_id do %>
User Id: <%= f.text_field :user_id %>
<% end %>
You can do it this way:
<%= f.label :user_id, 'User Id' %>
<%= f.text_field :user_id %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.