teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

エラー文の追加

2020/07/23 10:11

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  ### 発生している問題・エラーメッセージ
8
8
  ActionController::UrlGenerationError in Pages#home
9
+ Showing /app/views/likes/_likes.html.erb where line #9 raised:
9
10
  No route matches {:action=>"create", :controller=>"likes", :micropost_id=>nil}, missing required keys: [:micropost_id]
10
11
 
11
12
  ### 該当のソースコード

1

エラー文の追加、コードの修正

2020/07/23 10:11

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -5,12 +5,15 @@
5
5
  お分かりになられる方いましたら教えていただきたいです、よろしくお願いします。
6
6
 
7
7
  ### 発生している問題・エラーメッセージ
8
-
8
+ ActionController::UrlGenerationError in Pages#home
9
9
  No route matches {:action=>"create", :controller=>"likes", :micropost_id=>nil}, missing required keys: [:micropost_id]
10
10
 
11
11
  ### 該当のソースコード
12
12
 
13
13
  該当のお気にりフォームコード
14
+
15
+
16
+ ``````ここに言語を入力
14
17
  <% if @micropost.like_user(current_user.id) %>
15
18
  <%= button_to micropost_like_path(likes, micropost_id: micropost.id), method: :delete, id: "like-button", remote: true do %>
16
19
  <%= image_tag("icon_good.png") %>
@@ -26,15 +29,18 @@
26
29
  </span>
27
30
  <% end %>
28
31
  <% end %>
32
+ ```
29
33
 
30
34
  エラー該当のhome_controller
31
35
 
36
+ ```ここに言語を入力
32
37
  before_action :logged_in_user, only: [:home]
33
38
  def home
34
39
  @micropost = current_user.microposts.build
35
40
  @feed_items = current_user.feed.paginate(page: params[:page])
36
41
  @likes = Like.where(micropost_id: params[:micropost_id])
37
42
  end
43
+ ```
38
44
 
39
45
  ### 試したこと
40
46