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
This commit is contained in:
parent
2dc684c486
commit
8be05afff8
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue