質問編集履歴
1
状況が変わりましたので内容を変更しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,6 +50,25 @@
|
|
50
50
|
$('#likes_buttons_<%= @post.id %>').html("<%= j(render partial: 'likes/like', locals: {post: @post}) %>");
|
51
51
|
|
52
52
|
```
|
53
|
+
|
54
|
+
```
|
55
|
+
Likes_contoroller
|
56
|
+
|
57
|
+
def create
|
58
|
+
@post = Post.find(params[:post_id])
|
59
|
+
like = current_user.likes.build(post_id: params[:post_id])
|
60
|
+
like.save
|
61
|
+
end
|
62
|
+
|
63
|
+
def destroy
|
64
|
+
@post = Post.find(params[:post_id])
|
65
|
+
like = Like.find_by(post_id: params[:post_id], user_id: current_user.id)
|
66
|
+
like.destroy
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
```
|
53
72
|
### 試したこと
|
54
73
|
|
55
74
|
1の仮説で問題解決を取り組んだところ、星のマークが数字の左へ行ったり、右へ行ったり、またはエラーを出してしまったりして私が思った通りのものができませんでした。
|