質問編集履歴
2
追加補足の記述しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -194,6 +194,10 @@
|
|
194
194
|
|
195
195
|
```
|
196
196
|
|
197
|
+
###追加補足
|
198
|
+
|
199
|
+
Userモデルはdevise+Omniauthで実装済みです。
|
200
|
+
|
197
201
|
|
198
202
|
|
199
203
|
###開発環境
|
1
コードの一部変更とエラー内容を追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,6 +8,36 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
###エラー内容
|
12
|
+
|
13
|
+
```
|
14
|
+
|
15
|
+
NoMethodError in ShortsController#index
|
16
|
+
|
17
|
+
undefined method `shorts' for #<User:0x007f004de722d8>
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
Extracted source (around line #8):
|
22
|
+
|
23
|
+
# GET /shorts.json
|
24
|
+
|
25
|
+
def index
|
26
|
+
|
27
|
+
@shorts = current_user.shorts.all
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# GET /shorts/1
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
|
11
41
|
###問題のcontrollerのコードです。
|
12
42
|
|
13
43
|
```
|
@@ -26,7 +56,7 @@
|
|
26
56
|
|
27
57
|
def index
|
28
58
|
|
29
|
-
@shorts = current_user.short.all
|
59
|
+
@shorts = current_user.shorts.all
|
30
60
|
|
31
61
|
end
|
32
62
|
|
@@ -146,7 +176,7 @@
|
|
146
176
|
|
147
177
|
def set_short
|
148
178
|
|
149
|
-
@short = current_user.shor.find(params[:id])
|
179
|
+
@short = current_user.shorts.find(params[:id])
|
150
180
|
|
151
181
|
end
|
152
182
|
|
@@ -162,8 +192,6 @@
|
|
162
192
|
|
163
193
|
end
|
164
194
|
|
165
|
-
|
166
|
-
|
167
195
|
```
|
168
196
|
|
169
197
|
|