質問編集履歴
1
①該当コードを</>の中に移動 ②app/controllers/helpers/famers_helper.rb内に『#ここが59行目#』を追記です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,13 +12,13 @@
|
|
12
12
|
Showing /home/ubuntu/environment/minnanofarm/app/views/farmers/index.html.erb where line #59 raised:
|
13
13
|
|
14
14
|
undefined method `include?' for nil:NilClass
|
15
|
-
### 該当のソースコード
|
16
|
-
■app/controllers/helpers/famers_helper.rb■
|
17
15
|
|
16
|
+
###該当のコード(app/controllers/helpers/famers_helper.rb)
|
17
|
+
```
|
18
18
|
module FarmersHelper
|
19
19
|
|
20
20
|
def find_youtube_url(youtube_url)
|
21
|
-
if youtube_url.include?("https://youtu.be/")
|
21
|
+
if youtube_url.include?("https://youtu.be/") #ここが59行目#
|
22
22
|
binding.pry
|
23
23
|
youtube_url.strip!.gsub("https://youtu.be/", "")
|
24
24
|
# "https://youtu.be/WGiUk8VakxQ" 11桁のyoutubeのURLが出力されるようにする
|
@@ -28,9 +28,9 @@
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
```
|
32
|
-
|
32
|
+
###app/views/farmers/index.html.erb
|
33
|
-
|
33
|
+
```
|
34
34
|
<h1>働き手(Cast)を探す</h1>
|
35
35
|
|
36
36
|
<div class="row">
|
@@ -89,7 +89,7 @@
|
|
89
89
|
<%= work.title %><br>
|
90
90
|
<%= work.work_date %><br>
|
91
91
|
<%= work.work_type %><br>
|
92
|
-
|
92
|
+
<% if work.youtube_url.present? %>
|
93
93
|
<iframe width="560" height="315" src="https://www.youtube.com/embed/<%= find_youtube_url(work.youtube_url) %>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
94
94
|
|
95
95
|
</div>
|
@@ -97,8 +97,6 @@
|
|
97
97
|
<% end %>
|
98
98
|
</div> <!-- row -->
|
99
99
|
|
100
|
-
```ここに言語名を入力
|
101
|
-
ソースコード
|
102
100
|
```
|
103
101
|
|
104
102
|
### 試したこと
|