summaryrefslogtreecommitdiff
path: root/app/controllers/forums_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/forums_controller.rb')
-rw-r--r--app/controllers/forums_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 761a86b..206f01f 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -11,7 +11,7 @@ class ForumsController < ApplicationController
@threads = @forum.forumthreads.select {|f| f.can_read?(current_user) }.to_a
@threads.sort_by! do |t|
# sticky goes first, then sort by last activity (new replies)
- [t.sticky ? 0 : 1, -(t.replies.last.try(:created_at) || t.created_at).to_i]
+ [t.sticky ? 0 : 1, -(t.replies.order(:id).last.try(:created_at) || t.created_at).to_i]
end
@threads = Kaminari.paginate_array(@threads).page(params[:page])
end