Define Principal#name so all subclasses will have some sort of name when printed.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4076 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-09-10 18:46:23 +00:00
parent 3a2efb4757
commit 4c656fcffc
1 changed files with 5 additions and 1 deletions

View File

@ -34,6 +34,10 @@ class Principal < ActiveRecord::Base
before_create :set_default_empty_values
def name(formatter = nil)
to_s
end
def <=>(principal)
if self.class.name == principal.class.name
self.to_s.downcase <=> principal.to_s.downcase