@@ -33,6 +33,11 class Principal < ActiveRecord::Base | |||
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | def <=>(principal) |
|
36 |
self. |
|
|
36 | if self.class.name == principal.class.name | |
|
37 | self.to_s.downcase <=> principal.to_s.downcase | |
|
38 | else | |
|
39 | # groups after users | |
|
40 | principal.class.name <=> self.class.name | |
|
41 | end | |
|
37 | 42 | end |
|
38 | 43 | end |
@@ -214,11 +214,6 class User < Principal | |||
|
214 | 214 | def self.find_by_mail(mail) |
|
215 | 215 | find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase]) |
|
216 | 216 | end |
|
217 | ||
|
218 | # Sort users by their display names | |
|
219 | def <=>(user) | |
|
220 | self.to_s.downcase <=> user.to_s.downcase | |
|
221 | end | |
|
222 | 217 | |
|
223 | 218 | def to_s |
|
224 | 219 | name |
General Comments 0
You need to be logged in to leave comments.
Login now