How to add additional params to a button_to form?

前端 未结 7 1996
迷失自我
迷失自我 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:31

    If I read things correctly what you are effectively wanting to do something specific when a standard rails form is submitted in the standard way.

    Notice that when a form is submitted using e.g.

    f.submit "Save Changes"

    then

    params[:commit] = "Save Changes"

    The GOOD thing about this is that it can allow you to do some appropriate branching in the controllers update action.

    The BAD thing is that it's brittle. If one day you or someone else decides to change the button text, things break.. which is bad.

    K

    0 讨论(0)
提交回复
热议问题