summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-23 17:18:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-23 17:18:21 +0000
commit9fe0dd051dc206c7409164ba9a92a74609484aeb (patch)
tree9049f87d1a2e697e94a988c39dc15168d908c291 /app/models
parent3782501275e3b37ee1d15442604961fcb9a2537f (diff)
downloadredmine-9fe0dd051dc206c7409164ba9a92a74609484aeb.tar.gz
redmine-9fe0dd051dc206c7409164ba9a92a74609484aeb.zip
User's projects alphabetically sorted in the Projects drop down menu.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@538 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 1c5613856..d025651c4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -18,7 +18,12 @@
require "digest/sha1"
class User < ActiveRecord::Base
- has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => :delete_all
+ # Account statuses
+ STATUS_ACTIVE = 1
+ STATUS_REGISTERED = 2
+ STATUS_LOCKED = 3
+
+ has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :order => "#{Project.table_name}.name", :dependent => :delete_all
has_many :projects, :through => :memberships
has_many :custom_values, :dependent => :delete_all, :as => :customized
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
@@ -44,11 +49,6 @@ class User < ActiveRecord::Base
validates_confirmation_of :password, :allow_nil => true
validates_associated :custom_values, :on => :update
- # Account statuses
- STATUS_ACTIVE = 1
- STATUS_REGISTERED = 2
- STATUS_LOCKED = 3
-
def before_save
# update hashed_password if password was set
self.hashed_password = User.hash_password(self.password) if self.password