“No route matches [POST]” when changing link_to to button_to

前端 未结 4 675
余生分开走
余生分开走 2021-02-04 04:45

I have this piece of code:

<%= link_to \"New User\", new_user_path, :class => \"button\"  %>

which works fine, but when I

4条回答
  •  深忆病人
    2021-02-04 05:13

    Jesus Rodriguez is right about POST and GET, but if you really need the button you can simply override the default method:

    <%= button_to "New User", new_user_path, :class => "button", :method => :get  %>
    

提交回复
热议问题