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

后端 未结 10 887
你的背包
你的背包 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条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 16:02

    Building on @daniel's answer, you can also customize submit tag values on a per-model basis:

    en:
      helpers:
        submit:
          model_name:
            create: "Create"
            update: "Update"
    

    And then in your form you can just use:

    <%= f.submit %>
    

    See here for the documentation (second example.)

提交回复
热议问题