Merge pull request #106 from srgpqt/recent_threads

fix User#recent_threads for postgresql
This commit is contained in:
joshua stein 2014-01-20 17:27:03 -08:00
commit 27caa0a7a6

View file

@ -183,7 +183,8 @@ class User < ActiveRecord::Base
end
def recent_threads(amount)
self.comments.order('created_at desc').limit(amount).uniq.pluck(:thread_id)
self.comments.group(:thread_id).order('MAX(created_at) DESC').limit(
amount).pluck(:thread_id)
end
def stories_submitted_count