diff --git a/app/models/search_log.rb b/app/models/search_log.rb index 8cabdbfee95..8308a244437 100644 --- a/app/models/search_log.rb +++ b/app/models/search_log.rb @@ -58,6 +58,7 @@ class SearchLog < ActiveRecord::Base END) AS click_through, MODE() WITHIN GROUP (ORDER BY clicked_topic_id) AS clicked_topic_id, COUNT(DISTINCT ip_address) AS unique") + .includes(:topic) .where('created_at > ?', start_of(period)) .group(:term) .order('COUNT(DISTINCT ip_address) DESC')