summaryrefslogtreecommitdiffstats
path: root/app/models/enumeration.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-11 10:26:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-11 10:26:12 +0000
commit0471de41ff4828345ca0afa393f4b8f3bf0098d2 (patch)
treeba8c101be1d1d5adda486d06f32836d5ed59e041 /app/models/enumeration.rb
parent1ad16c2238be1b1e0cc29435203b8fd8c233a85c (diff)
downloadredmine-0471de41ff4828345ca0afa393f4b8f3bf0098d2.tar.gz
redmine-0471de41ff4828345ca0afa393f4b8f3bf0098d2.zip
Resourcified enumerations.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8189 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/enumeration.rb')
-rw-r--r--app/models/enumeration.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb
index b8cbd84f2..826955cc8 100644
--- a/app/models/enumeration.rb
+++ b/app/models/enumeration.rb
@@ -16,6 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Enumeration < ActiveRecord::Base
+ include Redmine::SubclassFactory
+
default_scope :order => "#{Enumeration.table_name}.position ASC"
belongs_to :project
@@ -27,6 +29,8 @@ class Enumeration < ActiveRecord::Base
before_destroy :check_integrity
before_save :check_default
+ attr_protected :type
+
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:type, :project_id]
validates_length_of :name, :maximum => 30