Custom name for params hash from Rails form_for

后端 未结 1 432
野趣味
野趣味 2021-02-12 01:56

Ordinarily, using form_for(@foo) means that on the back end of the form\'s action, you\'ll have the form data in params[:foo], but in my case I\'d like

1条回答
  •  余生分开走
    2021-02-12 02:11

    What you are looking for is:

    form_for(@foo, :as => :bar)
    

    The documentation for this can be found at:

    http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html

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