diff options
Diffstat (limited to 'app/models/principal.rb')
-rw-r--r-- | app/models/principal.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/principal.rb b/app/models/principal.rb index e62b5f320..4cce97e26 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -151,9 +151,11 @@ class Principal < ActiveRecord::Base end def <=>(principal) - if principal.nil? - -1 - elsif self.class.name == principal.class.name + # avoid an error when sorting members without roles (#10053) + return -1 if principal.nil? + return nil unless principal.is_a?(Principal) + + if self.class.name == principal.class.name self.to_s.casecmp(principal.to_s) else # groups after users |