summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/role.rb4
-rw-r--r--app/models/user.rb6
2 files changed, 9 insertions, 1 deletions
diff --git a/app/models/role.rb b/app/models/role.rb
index 7798f3bc6..a60319c55 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -26,6 +26,10 @@ class Role < ActiveRecord::Base
validates_uniqueness_of :name
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+ def <=>(role)
+ position <=> role.position
+ end
+
private
def check_integrity
raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])
diff --git a/app/models/user.rb b/app/models/user.rb
index 514517de6..60baa72da 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -141,7 +141,11 @@ class User < ActiveRecord::Base
token = Token.find_by_value(key)
token && token.user.active? ? token.user : nil
end
-
+
+ def <=>(user)
+ lastname <=> user.lastname
+ end
+
private
# Return password digest
def self.hash_password(clear_password)