]> source.dussan.org Git - redmine.git/commitdiff
Display users then groups on project memberships view (#4389).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Dec 2009 11:20:26 +0000 (11:20 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Dec 2009 11:20:26 +0000 (11:20 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3161 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/principal.rb
app/models/user.rb

index 9ec0f6ff87439cf3b4d009752ecd4ac061266419..37d2a545d66b1cc1a224126d5ba8305c112cb67a 100644 (file)
@@ -33,6 +33,11 @@ class Principal < ActiveRecord::Base
   }
   
   def <=>(principal)
-    self.to_s.downcase <=> principal.to_s.downcase
+    if self.class.name == principal.class.name
+      self.to_s.downcase <=> principal.to_s.downcase
+    else
+      # groups after users
+      principal.class.name <=> self.class.name
+    end
   end
 end
index e9c58bcc5734c09c6f423cabb36cd537d5c9519f..4cfa2b47b81376f1da8a64242bdbc35a2e22659a 100644 (file)
@@ -214,11 +214,6 @@ class User < Principal
   def self.find_by_mail(mail)
     find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase])
   end
-
-  # Sort users by their display names
-  def <=>(user)
-    self.to_s.downcase <=> user.to_s.downcase
-  end
   
   def to_s
     name