FIX: add table name to topic view query (#10052)

FIX: add table name to topic view query (#10052)

When plugin is hooking into TopicView joining other tables, it may fail because created_at is potentially available on 2 tables. Therefore we should explicitly define which created_at we want.

diff --git a/lib/topic_view.rb b/lib/topic_view.rb
index 42405f8..0ab7c7f 100644
--- a/lib/topic_view.rb
+++ b/lib/topic_view.rb
@@ -546,7 +546,7 @@ class TopicView
       columns = [:id]
       if !is_mega_topic?
-        columns << 'EXTRACT(DAYS FROM CURRENT_TIMESTAMP - created_at)::INT AS days_ago'
+        columns << 'EXTRACT(DAYS FROM CURRENT_TIMESTAMP - posts.created_at)::INT AS days_ago'

GitHub sha: dcb816b5

1 Like

This commit appears in #10052 which was approved by tgxworld. It was merged by lis2.