@ryunosuke1204

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Ruby on Railsコメント機能及びいいね機能の実装

解決したいこと

Ruby on Railsでインスタグラムのようなアプリをつくっています。
いいね機能を実装し、コメント投稿を行おうとした際に下記エラーが出現します。
解決方法を教えて下さい。

発生している問題・エラー

ActionController::UrlGenerationError in Comments#create
Showing /Users/matsushitaryunosuke/pf/Lookat/app/views/posts/show.html.erb where line #57 raised:

No route matches {:action=>"create", :controller=>"favorites", :id=>nil, :post_id=>"1"}, missing required keys: [:id]

Commentコントローラー
0a04051bfbf7c0de62dda736fc668fc7.png
Favoriteコントローラー
d3bb6265fbc845e445fc525dec8da77c.png
routes.rb
16762dd5acb46e50f9b81b801fb63c87.png
show.html.erb[ <%= link_to 'お気に入り登録する', post_create_favorite_path(@post)でも同様のエラーが出ます。]
7c8215aa1c55b90feae392b51db53f45.png

0 likes

No Answers yet.

Your answer might help someone💌