From 759f4b4fe92bdf74107ad38a00de57ec1a2cfb2e Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 24 Apr 2014 09:19:59 +1000 Subject: [PATCH] BUGFIX: category name is reserved in multisite --- app/models/topic.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/models/topic.rb b/app/models/topic.rb index 8aa2c1e5bf9..55cdc4b1f58 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -55,13 +55,17 @@ class Topic < ActiveRecord::Base :case_sensitive => false, :collection => Proc.new{ Topic.listable_topics } } - validates :category_id, :presence => true ,:exclusion => {:in => [SiteSetting.uncategorized_category_id]}, - :if => Proc.new { |t| - (t.new_record? || t.category_id_changed?) && - !SiteSetting.allow_uncategorized_topics && - (t.archetype.nil? || t.archetype == Archetype.default) && - (!t.user_id || !t.user.staff?) - } + validates :category_id, + :presence => true, + :exclusion => { + :in => Proc.new{[SiteSetting.uncategorized_category_id]} + }, + :if => Proc.new { |t| + (t.new_record? || t.category_id_changed?) && + !SiteSetting.allow_uncategorized_topics && + (t.archetype.nil? || t.archetype == Archetype.default) && + (!t.user_id || !t.user.staff?) + } before_validation do