質問編集履歴
1
状況が変わりましたので内容を変更しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -102,6 +102,44 @@
|
|
102
102
|
|
103
103
|
```
|
104
104
|
|
105
|
+
|
106
|
+
|
107
|
+
```
|
108
|
+
|
109
|
+
Likes_contoroller
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
def create
|
114
|
+
|
115
|
+
@post = Post.find(params[:post_id])
|
116
|
+
|
117
|
+
like = current_user.likes.build(post_id: params[:post_id])
|
118
|
+
|
119
|
+
like.save
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
def destroy
|
126
|
+
|
127
|
+
@post = Post.find(params[:post_id])
|
128
|
+
|
129
|
+
like = Like.find_by(post_id: params[:post_id], user_id: current_user.id)
|
130
|
+
|
131
|
+
like.destroy
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
```
|
142
|
+
|
105
143
|
### 試したこと
|
106
144
|
|
107
145
|
|