diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 0e816fb..683a3ab 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -15,8 +15,13 @@
<%= link_to f.name, f, id: "forum-#{f.id}"%>
- <% if trd = f.threads.last %> - <%= trd.author.name %> <%= link_to "posted", forumthread_path(trd) %> . + <% if last_thread = f.threads.last %> + <% last_reply = Threadreply.where(forumthread: f.threads).order(:created_at).last %> + <% if last_reply && last_reply.created_at > last_thread.created_at %> + <%= last_reply.author.name %> <%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %> . + <% else %> + <%= last_thread.author.name %> <%= link_to "posted", forumthread_path(last_thread) %> . + <% end %> <% else %> No posts yet. <% end %>