This commit is contained in:
r888888888
2013-05-07 18:19:30 -07:00
parent 49de333b74
commit 0535237704
6 changed files with 11 additions and 7 deletions

View File

@@ -97,7 +97,10 @@ class ForumPost < ActiveRecord::Base
end
def update_topic_updated_at_on_destroy
topic.update_column(:updated_at, ForumPost.where(:topic_id => topic.id).maximum(:updated_at))
max = ForumPost.where(:topic_id => topic.id).maximum(:updated_at)
if max
topic.update_column(:updated_at, max)
end
end
def initialize_creator

View File

@@ -40,7 +40,8 @@ class User < ActiveRecord::Base
before_create :promote_to_admin_if_first_user
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
has_many :posts, :foreign_key => "uploader_id"
has_one :ban
has_many :bans, :order => "bans.id desc"
has_one :recent_ban, :class_name => "Ban", :order => "bans.id desc"
has_many :subscriptions, :class_name => "TagSubscription", :foreign_key => "creator_id", :order => "name"
has_many :note_versions, :foreign_key => "updater_id"
has_many :dmails, :foreign_key => "owner_id", :order => "dmails.id desc"