回答編集履歴

2

修正

2017/03/14 06:41

投稿

moke
moke

スコア2241

test CHANGED
@@ -22,6 +22,8 @@
22
22
 
23
23
  というふうにすれば、とりあえず思い通りの結果が表示されると思います。
24
24
 
25
+ あまりスマートではないですが。
26
+
25
27
 
26
28
 
27
29
  もし必要なら、別質問を立て、各モデルを晒してくださればリファクタリングのお手伝いもできますが。。

1

レイアウトも修正

2017/03/14 06:41

投稿

moke
moke

スコア2241

test CHANGED
@@ -8,27 +8,19 @@
8
8
 
9
9
  <% @notifications.each do |notification| %>
10
10
 
11
- <p>
11
+ <%= (content_tag :p ,"#{notification.comment.user.try(:name)}さんが
12
12
 
13
- <%= notification.comment.user.try(:name) if notification.comment.present? %>さんが
13
+ あなたの投稿#{<%= (link_to notification.comment.topic.title, topic_path(notification.comment.topic, notification_id: notification.id)})にコメントしました。") if notification.comment.present? %>
14
14
 
15
- あなたの投稿(<%= (link_to "#{notification.comment.topic.title}", topic_path(notification.comment.topic, notification_id: notification.id)) if notification.comment.present? %>)にコメントしました。
15
+ <%= (content_tag :p ,"#{notification.commenttl.user.try(:name)}さんが
16
16
 
17
- </p>
18
-
19
- <p>
20
-
21
- <%= notification.commenttl.user.try(:name) if notification.commenttl.present? %>さんが
22
-
23
- あなたの投稿(<%= (link_to "#{notification.commenttl.timeline.content}", timeline_path(notification.commenttl.timeline, notification_id: notification.id)) if notification.commenttl.present? %>)にコメントしました。
24
-
25
- </p>
17
+ あなたの投稿(#{<%= (link_to notification.commenttl.timeline.content, timeline_path(notification.commenttl.timeline, notification_id: notification.id)})にコメントしました。") if notification.commenttl.present? %>
26
18
 
27
19
  <% end %>
28
20
 
29
21
  ```
30
22
 
31
- というふうにすれば、レイアウトはもかく、とりあえず思い通りの結果が表示されると思います。
23
+ というふうにすれば、とりあえず思い通りの結果が表示されると思います。
32
24
 
33
25
 
34
26