Rails is not passing the “commit” button parameter

前端 未结 5 924
醉梦人生
醉梦人生 2021-02-08 05:27

Reinstalling a Rails app on a new server. Part of the app can fork in one of two directions based on the button the user selects. This part isn\'t working, and when I look at

5条回答
  •  孤独总比滥情好
    2021-02-08 06:01

    Just add name: "commit", value: "Save"to your form submit button:

    form_for @object do |f|
      ...
      f.button :submit, "Save", name: "commit", value:"Save"
    end
    

    and then you will have params[:commit] equals to "Save" in the controller.

提交回复
热议问题