Rails change routing of submit in form_for

陌路散爱 提交于 2019-12-03 01:44:41

:url - The URL the form is submitted to. It takes the same fields you pass to url_for or link_to. In particular you may pass here a named route directly as well. Defaults to the current action.

<% form_for :thing, :url => {:action => "update", :id => @thing} do |f| %>

you can also pass it the path_name by using the helper. so you can also do something like

:url => update_article_path(@article)
Antonio Jha

Try form_for (:thing, url:{:controller=>'thing', :action=>'update'}, html:{method:'put'}).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!