質問編集履歴

2

コードを追記致しました

2019/02/05 07:45

投稿

broly
broly

スコア13

test CHANGED
File without changes
test CHANGED
@@ -45,3 +45,77 @@
45
45
  data-turbolinks="false"をaタグにセットすれば問題なく画像は表示されますが、できればturbolinksは残したいです。
46
46
 
47
47
  どなたかこのバグに心当たりある方いませんか?
48
+
49
+
50
+
51
+
52
+
53
+ コードの追記
54
+
55
+ =
56
+
57
+ 以下かなり抜粋しておりますがコードの追記となります。
58
+
59
+
60
+
61
+ show.html.erb
62
+
63
+ ```
64
+
65
+ <%= render "diary", diary: @diary, role: "diary_show", comments: @comments %>
66
+
67
+ ```
68
+
69
+
70
+
71
+ _diary.html.erb
72
+
73
+ diary箇所を部分テンプレートで出しています
74
+
75
+ ```
76
+
77
+ <div class="comment-area">
78
+
79
+ <div class="display-comments">
80
+
81
+ <% if role == "diary_index" %>
82
+
83
+ <%= render partial: "diary_comments", collection: diary.comments, as: :comment, locals: {diary: diary} %>
84
+
85
+ <% else %>
86
+
87
+ <%= render partial: "diary_comments", collection: comments, as: :comment, locals: {diary: diary} %>
88
+
89
+ <% end %>
90
+
91
+ </div>
92
+
93
+ </div>
94
+
95
+ ```
96
+
97
+
98
+
99
+ _diary_comments.html.erb
100
+
101
+ diaryのcommentをcollectionで出しています
102
+
103
+ ここのimage_tagでユーザー画像がある場合とない場合を出し分けていますが、バグにより両方共表示されません。
104
+
105
+ ```
106
+
107
+ <div class="message-user-image">
108
+
109
+ <% if comment.user.user_image.blank? %>
110
+
111
+ <%= image_tag 'user-blue.png', class: 'circle', alt:"user photo" %>
112
+
113
+ <% else %>
114
+
115
+ <%= image_tag(comment.user.user_image.image.thumb.url, class: 'circle', alt:"user photo") %>
116
+
117
+ <% end %>
118
+
119
+ </div>
120
+
121
+ ```

1

スクショの説明を追記

2019/02/05 07:45

投稿

broly
broly

スコア13

test CHANGED
File without changes
test CHANGED
@@ -30,6 +30,8 @@
30
30
 
31
31
 
32
32
 
33
+ 以下は、初回訪問時のバグ発生時と正常時のスクショです。
34
+
33
35
  ![初回訪問時のバグ発生時のスクショ](26e307800ac2088aa6824226c0edc3e1.png)
34
36
 
35
37
  ![正常な状態のスクショ](f4557843efb889425e684cdc224260be.png)