BUGFIX: category name is reserved in multisite

This commit is contained in:
Sam 2014-04-24 09:19:59 +10:00
parent ee8bbadfe8
commit 759f4b4fe9
1 changed files with 11 additions and 7 deletions

View File

@ -55,7 +55,11 @@ class Topic < ActiveRecord::Base
:case_sensitive => false,
:collection => Proc.new{ Topic.listable_topics } }
validates :category_id, :presence => true ,:exclusion => {:in => [SiteSetting.uncategorized_category_id]},
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 &&