From 0add72f2bd39f79c7916b1469253aaafc8f331f6 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 19 Mar 2014 16:23:43 -0700 Subject: [PATCH] fixes #2110 --- app/models/forum_post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index bd3000ddb..b0809d888 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -130,9 +130,9 @@ class ForumPost < ActiveRecord::Base end def update_topic_updated_at_on_destroy - max = ForumPost.where(:topic_id => topic.id, :is_deleted => false).maximum(:updated_at) + max = ForumPost.where(:topic_id => topic.id, :is_deleted => false).order("updated_at desc").first if max - ForumTopic.update_all(["response_count = response_count - 1, updated_at = ?", max], {:id => topic.id}) + ForumTopic.update_all(["response_count = response_count - 1, updated_at = ?, updater_id = ?", max.updated_at, max.updater_id], {:id => topic.id}) else ForumTopic.update_all(["response_count = response_count - 1"], {:id => topic.id}) end