No route matches [POST] “/articles/new”

前端 未结 7 1639
余生分开走
余生分开走 2020-12-31 09:57

When I try to submit the form its giving me the error

No route matches [POST] \"/articles/new\"

the files are: new.html.erb
this file

7条回答
  •  借酒劲吻你
    2020-12-31 10:34

    You can find the answer on the official guideline.

    Because this route goes to the very page that you're on right at the moment, and that route should only be used to display the form for a new article.

    Edit the form_with line inside app/views/articles/new.html.erb to look like this:

    <%= form_with scope: :article, url: articles_path, local: true do |form| %>
    

提交回复
热议问题