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

前端 未结 7 1663
余生分开走
余生分开走 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:18

    I was continually running into this problem and it came down to the fact that I had the following code in my navbar:

    <%= link_to "Blog", controller: 'articles' %>
    

    I switched to this and it all started working:

    <%= link_to "Blog", articles_path %>
    

    I'm still new to this so the different ways of doing things sometimes gets confusing.

提交回复
热议问题