Rails: Titlecase Only Capitalizes First Word in f.label

后端 未结 3 748
名媛妹妹
名媛妹妹 2021-02-04 00:40

The first line of code does what I want, the second only capitalizes the first word:

<%= the_label = \"Time_Balance\".titlecase %>
<%= f.lab
3条回答
  •  轮回少年
    2021-02-04 00:55

    try this.

    <%= f.label :time_balance, "Time Balance" %> 

    Label expects the first argument to be the method_name on the object the form is for, and defaults to just using it, unless you specify it explicitly as part of the second argument which is content/options.

提交回复
热议问题