How to add an html id to a form_for tag in rails?

前端 未结 3 1250
暗喜
暗喜 2021-02-11 19:36

I\'m trying to add an id tag to a form that I\'m creating in rails. The beginning of the form has the following code:

<%= form_for(@user) do |f| %>
         


        
3条回答
  •  离开以前
    2021-02-11 20:16

    try this <%= form_for @user, :url => "controller action url", :html => {:id => "Blabla"} do |f| %>

    EDIT: If you don't want custom action URL then you can use this as well <%= form_for @user, html: {id: "BlaBla"} do |f| %>

提交回复
热议问题