に無視します:ActionController::RoutingError (No route matches [POST] "/articles/new"):
Railsのヘルパーは、()URLパラメータエラーを取得
/articles/new
ページからPOSTを行います。
/app/views/articles/new.html.erb
内部マイ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
出力:でresources with form_for
を使用する方法について
<%= form_for Article.new do |f| %>
読む:
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
ありがとうございますが、残念ながらそれは役に立ちませんでした。その他の提案はありますか?そのようなことをデバッグする方法の提案ですか? –
'config/routes.rb'を投稿してください。そのファイルに記事ルートを追加した後にサーバーを再起動しましたか? – spickermann
これは私が推測する私の愚かさの正式な証明です。私はフォームを提出した後で、私が作ったコードの変更で実際にフォームをリフレッシュしたことがなくなったばかりです。私は例外を発生させてみたが、うまくいかなかったので、これは明らかになった。助けてくれてありがとう! –