Rails: Custom text for rails form_for label

后端 未结 3 440
野趣味
野趣味 2020-12-24 00:23

I want to display a label in form_for:

<%= f.label :name %>
<%= f.text_field :name %> &l
3条回答
  •  轮回少年
    2020-12-24 00:38

    The second parameter to label helper will allow you to set custom text.

    <%= f.label :name, 'Your Name' %>
    

    Use Ruby on Rails Documentation to look up helper methods.

提交回复
热议问题