##// END OF EJS Templates
User's projects alphabetically sorted in the Projects drop down menu....
Jean-Philippe Lang -
r535:9fe0dd051dc2
parent child
Show More
@@ -18,7 +18,12
18 require "digest/sha1"
18 require "digest/sha1"
19
19
20 class User < ActiveRecord::Base
20 class User < ActiveRecord::Base
21 has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => :delete_all
21 # Account statuses
22 STATUS_ACTIVE = 1
23 STATUS_REGISTERED = 2
24 STATUS_LOCKED = 3
25
26 has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :order => "#{Project.table_name}.name", :dependent => :delete_all
22 has_many :projects, :through => :memberships
27 has_many :projects, :through => :memberships
23 has_many :custom_values, :dependent => :delete_all, :as => :customized
28 has_many :custom_values, :dependent => :delete_all, :as => :customized
24 has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
29 has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
@@ -44,11 +49,6 class User < ActiveRecord::Base
44 validates_confirmation_of :password, :allow_nil => true
49 validates_confirmation_of :password, :allow_nil => true
45 validates_associated :custom_values, :on => :update
50 validates_associated :custom_values, :on => :update
46
51
47 # Account statuses
48 STATUS_ACTIVE = 1
49 STATUS_REGISTERED = 2
50 STATUS_LOCKED = 3
51
52 def before_save
52 def before_save
53 # update hashed_password if password was set
53 # update hashed_password if password was set
54 self.hashed_password = User.hash_password(self.password) if self.password
54 self.hashed_password = User.hash_password(self.password) if self.password
General Comments 0
You need to be logged in to leave comments. Login now