From 7215a39d984649bc9bbac2ca543ababdc3e1aa74 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 7 Aug 2015 11:23:21 -0700 Subject: [PATCH] fixes #1903: First post of forum topic doesn't show "updated by" message --- app/models/forum_topic.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/forum_topic.rb b/app/models/forum_topic.rb index 237fb91ca..bc0046a3e 100644 --- a/app/models/forum_topic.rb +++ b/app/models/forum_topic.rb @@ -19,6 +19,7 @@ class ForumTopic < ActiveRecord::Base validates_associated :original_post validates_inclusion_of :category_id, :in => CATEGORIES.keys accepts_nested_attributes_for :original_post + after_update :update_orignal_post module CategoryMethods extend ActiveSupport::Concern @@ -159,4 +160,10 @@ class ForumTopic < ActiveRecord::Base def undelete! update_attributes({:is_deleted => false}, :as => CurrentUser.role) end + + def update_orignal_post + if original_post + original_post.update_columns(:updater_id => CurrentUser.id, :updated_at => Time.now) + end + end end