質問編集履歴
1
質問のタイトルが質問内容と少し合っていなかったので修正、コードも今の自分なりに調べたコード、それで出たエラーを記述し直した
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
画像をクリックしたら詳細ページ
|
1
|
+
投稿された画像をクリックしたら投稿者名やタイトルなどの詳細ページを表示したい
|
body
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
前提・実現したいこと
|
2
2
|
---
|
3
|
-
|
3
|
+
Railsで実装課題に取り組み中です。投稿された画像をクリックすると、投稿した人の名前やタイトルなどを表示する詳細ページを表示したいです。
|
4
4
|
|
5
5
|
発生している問題・エラーメッセージ
|
6
6
|
---
|
7
|
-
|
7
|
+
NameError in Prototypes#show
|
8
|
+
Showing /Users/xxxxxxxxx/projects/protospace-xxxxx/app/views/prototypes/show.html.erb where line #15 raised:
|
8
9
|
|
10
|
+
undefined local variable or method `prototype' for #<#<Class:0x00007f9938b0c128>:0x00007f9938b16808>
|
11
|
+
Did you mean? prototype_url
|
12
|
+
|
9
13
|
該当のソースコード
|
10
14
|
---
|
11
15
|
show.html.erb
|
@@ -14,9 +18,9 @@
|
|
14
18
|
<div class="inner">
|
15
19
|
<div class="prototype__wrapper">
|
16
20
|
<p class="prototype__hedding">
|
17
|
-
<%=
|
21
|
+
<%= プロトタイプタイトル %>
|
18
22
|
</p>
|
19
|
-
<%= link_to "by
|
23
|
+
<%= link_to "by #{prototype.user.name}", prototype_path(prototype.user_id), method: :get, class: :prototype__user %>
|
20
24
|
<%# プロトタイプの投稿者とログインしているユーザーが同じであれば以下を表示する %>
|
21
25
|
<div class="prototype__manage">
|
22
26
|
<%= link_to "編集する", root_path, class: :prototype__btn %>
|
@@ -30,13 +34,13 @@
|
|
30
34
|
<div class="prototype__detail">
|
31
35
|
<p class="detail__title">キャッチコピー</p>
|
32
36
|
<p class="detail__message">
|
33
|
-
<%=
|
37
|
+
<%= キャッチコピー %>
|
34
38
|
</p>
|
35
39
|
</div>
|
36
40
|
<div class="prototype__detail">
|
37
41
|
<p class="detail__title">コンセプト</p>
|
38
42
|
<p class="detail__message">
|
39
|
-
<%=
|
43
|
+
<%= コンセプト %>
|
40
44
|
</p>
|
41
45
|
</div>
|
42
46
|
</div>
|
@@ -187,16 +191,13 @@
|
|
187
191
|
prototype GET /prototypes/:id(.:format) prototypes#show
|
188
192
|
|
189
193
|
```
|
190
|
-
※今表示されている、画像クリック後の詳細ページ
|
191
|
-
<https://gyazo.com/3ec27d7737dcef8b3a154dddc40f188e>
|
192
|
-
|
193
194
|
試したこと
|
194
195
|
---
|
195
|
-
|
196
|
+
|
196
197
|
・”画像クリック 詳細ページ”などでネット検索をした
|
198
|
+
・カリキュラムを読んだ
|
199
|
+
・show.html.erb内のimage tagメソッドのURLの指定がおかしい?と仮説しています。カリキュラムやその周辺も読んでみたものの、行き詰まってしまい、かなり時間も経ってしまったので質問させていただきました。
|
197
200
|
|
198
|
-
・上記理由からshow.html.erb内のimage tagメソッドのURLの指定がおかしい?それ以外の名前やタイトルなども変数の指定ができていない?と仮説しています。カリキュラムやその周辺も読んでみたものの、行き詰まってしまい、かなり時間も経ってしまったので質問させていただきました。
|
199
|
-
|
200
201
|
補足情報(FW/ツールのバージョンなど)
|
201
202
|
---
|
202
203
|
Rails 6.0.3.4
|