Custom name for params hash from Rails form_for

后端 未结 1 431
野趣味
野趣味 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)
提交回复
热议问题