mirror of
https://github.com/redmine/redmine.git
synced 2026-02-06 23:00:15 +01:00
force set default document category if it is not set on database (#11665)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10221 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -31,4 +31,12 @@ class DocumentCategory < Enumeration
|
||||
def transfer_relations(to)
|
||||
documents.update_all("category_id = #{to.id}")
|
||||
end
|
||||
|
||||
def self.default
|
||||
d = super
|
||||
if d.nil?
|
||||
d = find(:first)
|
||||
end
|
||||
d
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,4 +38,8 @@ class DocumentCategoryTest < ActiveSupport::TestCase
|
||||
e.update_attributes(:is_default => true)
|
||||
assert_equal 3, DocumentCategory.default.id
|
||||
end
|
||||
|
||||
def test_force_default
|
||||
assert_equal 1, DocumentCategory.default.id
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user