質問編集履歴
2
エラー内容の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,15 +20,39 @@
|
|
20
20
|
|
21
21
|
```Ruby
|
22
22
|
|
23
|
-
N
|
23
|
+
NoMethodError in UsersController#likes
|
24
|
-
|
25
|
-
|
24
|
+
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
undefined
|
25
|
+
undefined method `likes' for nil:NilClass
|
26
|
+
|
30
|
-
|
27
|
+
Extracted source (around line #43):
|
28
|
+
|
29
|
+
41 def likes
|
30
|
+
|
31
|
-
|
31
|
+
42 @micropost = Micropost.find(params[:id])
|
32
|
+
|
33
|
+
43 @pagy, @likes = pagy(@user.likes)
|
34
|
+
|
35
|
+
44 counts(@user)
|
36
|
+
|
37
|
+
45 end
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
ails.root: /home/ubuntu/environment/microposts
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
Application Trace | Framework Trace | Full Trace
|
46
|
+
|
47
|
+
app/controllers/users_controller.rb:43:in `likes'
|
48
|
+
|
49
|
+
Request
|
50
|
+
|
51
|
+
Parameters:
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
{"id"=>"1"}
|
32
56
|
|
33
57
|
```
|
34
58
|
|
1
エラー箇所の説明追加、likesアクションの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -174,6 +174,8 @@
|
|
174
174
|
|
175
175
|
###users_controller.rb
|
176
176
|
|
177
|
+
favoritesのコードを入力後に実行されるコントローラー
|
178
|
+
|
177
179
|
```Ruby
|
178
180
|
|
179
181
|
class UsersController < ApplicationController
|
@@ -258,7 +260,7 @@
|
|
258
260
|
|
259
261
|
def likes
|
260
262
|
|
261
|
-
@
|
263
|
+
@micropost = micropost.find(params[:id])
|
262
264
|
|
263
265
|
@pagy, @likes = pagy(@user.likes)
|
264
266
|
|
@@ -356,6 +358,8 @@
|
|
356
358
|
|
357
359
|
###show.html.erb
|
358
360
|
|
361
|
+
下記18行目がナビゲーションタブのfavoritesのコードです。
|
362
|
+
|
359
363
|
```Ruby
|
360
364
|
|
361
365
|
<div class="row">
|