@@ -33,6 +33,11 class Principal < ActiveRecord::Base | |||||
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | def <=>(principal) |
|
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 | end |
|
42 | end | |
38 | end |
|
43 | end |
@@ -214,11 +214,6 class User < Principal | |||||
214 | def self.find_by_mail(mail) |
|
214 | def self.find_by_mail(mail) | |
215 | find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase]) |
|
215 | find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase]) | |
216 | end |
|
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 | def to_s |
|
218 | def to_s | |
224 | name |
|
219 | name |
General Comments 0
You need to be logged in to leave comments.
Login now