diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-08-21 13:45:53 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-08-21 13:45:53 +0000 |
commit | 665a331cc407f3143bece9caf0e19d48d2f66149 (patch) | |
tree | bb8ebae13bb11141029ff2a0912001054197d267 /app/models/document_category.rb | |
parent | 185ab2a0209c5b748a8f7568d7ed618a81bc5cff (diff) | |
download | redmine-665a331cc407f3143bece9caf0e19d48d2f66149.tar.gz redmine-665a331cc407f3143bece9caf0e19d48d2f66149.zip |
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
Diffstat (limited to 'app/models/document_category.rb')
-rw-r--r-- | app/models/document_category.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/document_category.rb b/app/models/document_category.rb index a7a2fd9d6..c22b81e5b 100644 --- a/app/models/document_category.rb +++ b/app/models/document_category.rb @@ -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 |