summaryrefslogtreecommitdiffstats
path: root/app/models/enumeration.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-08-21 01:14:40 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-08-21 01:14:40 +0000
commit8be05afff8bd399ee51fd47055c2e425e7e82445 (patch)
treeb830cbec88580fdb20f9547d45d9a9d872083776 /app/models/enumeration.rb
parent2dc684c48671d4e63c118a56ac2d6e8104189dcf (diff)
downloadredmine-8be05afff8bd399ee51fd47055c2e425e7e82445.tar.gz
redmine-8be05afff8bd399ee51fd47055c2e425e7e82445.zip
remove trailing white-spaces from app/models/enumeration.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6501 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/enumeration.rb')
-rw-r--r--app/models/enumeration.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb
index 71afe8fee..4965c31c6 100644
--- a/app/models/enumeration.rb
+++ b/app/models/enumeration.rb
@@ -1,31 +1,31 @@
-# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2011 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 Enumeration < ActiveRecord::Base
default_scope :order => "#{Enumeration.table_name}.position ASC"
-
+
belongs_to :project
-
+
acts_as_list :scope => 'type = \'#{type}\''
acts_as_customizable
acts_as_tree :order => 'position ASC'
before_destroy :check_integrity
-
+
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:type, :project_id]
validates_length_of :name, :maximum => 30
@@ -45,7 +45,7 @@ class Enumeration < ActiveRecord::Base
find(:first, :conditions => { :is_default => true })
end
end
-
+
# Overloaded on concrete classes
def option_name
nil
@@ -56,12 +56,12 @@ class Enumeration < ActiveRecord::Base
Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
end
end
-
+
# Overloaded on concrete classes
def objects_count
0
end
-
+
def in_use?
self.objects_count != 0
end
@@ -70,9 +70,9 @@ class Enumeration < ActiveRecord::Base
def is_override?
!self.parent.nil?
end
-
+
alias :destroy_without_reassign :destroy
-
+
# Destroy the enumeration
# If a enumeration is specified, objects are reassigned
def destroy(reassign_to = nil)
@@ -81,11 +81,11 @@ class Enumeration < ActiveRecord::Base
end
destroy_without_reassign
end
-
+
def <=>(enumeration)
position <=> enumeration.position
end
-
+
def to_s; name end
# Returns the Subclasses of Enumeration. Each Subclass needs to be
@@ -115,13 +115,13 @@ class Enumeration < ActiveRecord::Base
return true
end
-
+
# Are the new and previous fields equal?
def self.same_active_state?(new, previous)
new = (new == "1" ? true : false)
return new == previous
end
-
+
private
def check_integrity
raise "Can't delete enumeration" if self.in_use?