From 6b7650e2f03156ea1e3985b30c1995e44c317e3d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 28 Jun 2006 18:11:03 +0000 Subject: Initial commit git-svn-id: http://redmine.rubyforge.org/svn/trunk@4 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- redmine/app/models/custom_field.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 redmine/app/models/custom_field.rb (limited to 'redmine/app/models/custom_field.rb') diff --git a/redmine/app/models/custom_field.rb b/redmine/app/models/custom_field.rb new file mode 100644 index 000000000..9e817d1ef --- /dev/null +++ b/redmine/app/models/custom_field.rb @@ -0,0 +1,38 @@ +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class CustomField < ActiveRecord::Base + + has_and_belongs_to_many :projects + has_many :custom_values, :dependent => true + has_many :issues, :through => :issue_custom_values + + validates_presence_of :name, :typ + validates_uniqueness_of :name + + TYPES = [ + [ "Integer", 0 ], + [ "String", 1 ], + [ "Date", 2 ], + [ "Boolean", 3 ], + [ "List", 4 ] + ].freeze + + def self.for_all + find(:all, :conditions => ["is_for_all=?", true]) + end +end -- cgit v1.2.3