获取错误:ActionController::RoutingError (No route matches [POST] "/articles/new"):
从/articles/new
页面执行POST时。
我在/app/views/articles/new.html.erb
内的代码:
<%= form_for :article, url: articles_path do |f| %>
<p>
<%= f.label :title %><br>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :text %><br>
<%= f.text_area :text %>
</p>
<p>
<%= f.submit %>
</p>
/bin/rake routes
输出:
Running via Spring preloader in process 1067
Prefix Verb URI Pattern Controller#Action
welcome_index GET /welcome/index(.:format) welcome#index
root GET / welcome#index
articles GET /articles(.:format) articles#index
POST /articles(.:format) articles#create
new_article GET /articles/new(.:format) articles#new
edit_article GET /articles/:id/edit(.:format) articles#edit
article GET /articles/:id(.:format) articles#show
PATCH /articles/:id(.:format) articles#update
PUT /articles/:id(.:format) articles#update
DELETE /articles/:id(.:format) articles#destroy
答案 0 :(得分:1)
答案 1 :(得分:0)
在我尝试提出异常并且无法正常工作后,我开始怀疑。然后我意识到带有表单的页面从未在浏览器中刷新过。我只是按下并重新提交表格。愚蠢的错误。
总是很难(没有浏览器缓存)REFRESHES !!!