How to add additional params to a button_to form?

前端 未结 7 2020
迷失自我
迷失自我 2020-12-23 11:41

I want to have a Submit button. It updates one field on the submission; submission.state = :submitted

Now, I could make a custom route and

7条回答
  •  醉酒成梦
    2020-12-23 12:29

    Add params:{} at the end, it will generate hidden_field

    <%= button_to user.name, user, class:"btn btn-default", style:"", method: :patch, remote: true, params: { a_field: false, an_other_field:"a new value" } %>
    

提交回复
热议问题