How to add additional params to a button_to form?

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

    As of Rails 3.2.1 you can add additional params to the :html_options hash using the :form key.

    http://apidock.com/rails/v3.2.1/ActionView/Helpers/UrlHelper/button_to

    This did not exist prior to 3.2.1 so the more verbose solution of declaring a form with hidden attributes was required.

提交回复
热议问题