Rails: How to change the text on the submit button in a Rails Form

后端 未结 10 916
你的背包
你的背包 2020-12-07 15:19

i have listed my _form.html.erb file below what i would like to do is change the text on the submit button i know how to do it in html but not shure how to do it in Rails 3<

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 15:46

    Sometimes using helpers is not acceptable because of used text or you need additionally add class etc., so you can directly override value:

    <%= f.submit class: 'btn btn-primary', value: 'Login' %>
    

    or:

    <%= f.button :submit, class: 'btn btn-primary', value: 'Login' %>
    

    By the way it was mentioned by @cassi.lup in comment to accepted answer.

    Tested on Rails 4.2.3.

提交回复
热议问题