From 9fe0dd051dc206c7409164ba9a92a74609484aeb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 23 May 2007 17:18:21 +0000 Subject: [PATCH] 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 --- app/models/user.rb | 12 ++++++------ 1 file 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 -- 2.39.5