summaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-27 20:13:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-27 20:13:56 +0000
commitce6cf66f6c3af26383cd25ed012d908be4b40bae (patch)
treedfecb66fd8cca4de280494515e0ad21ec6f32dfd /app/models/user.rb
parenta4a8b6381e4a162da85319e216a770ee7bd82202 (diff)
downloadredmine-ce6cf66f6c3af26383cd25ed012d908be4b40bae.tar.gz
redmine-ce6cf66f6c3af26383cd25ed012d908be4b40bae.zip
Custom fields refactoring: most of code moved from controllers to models (using new module ActsAsCustomizable).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1592 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 5568027d5..a34b96861 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -37,12 +37,13 @@ class User < ActiveRecord::Base
has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :conditions => "#{Project.table_name}.status=#{Project::STATUS_ACTIVE}", :order => "#{Project.table_name}.name", :dependent => :delete_all
has_many :projects, :through => :memberships
- has_many :custom_values, :dependent => :delete_all, :as => :customized
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
has_one :rss_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='feeds'"
belongs_to :auth_source
+ acts_as_customizable
+
attr_accessor :password, :password_confirmation
attr_accessor :last_before_login_on
# Prevents unauthorized assignments
@@ -60,7 +61,6 @@ class User < ActiveRecord::Base
validates_length_of :mail, :maximum => 60, :allow_nil => true
validates_length_of :password, :minimum => 4, :allow_nil => true
validates_confirmation_of :password, :allow_nil => true
- validates_associated :custom_values, :on => :update
def before_create
self.mail_notification = false
@@ -280,6 +280,10 @@ class AnonymousUser < User
errors.add_to_base 'An anonymous user already exists.' if AnonymousUser.find(:first)
end
+ def available_custom_fields
+ []
+ end
+
# Overrides a few properties
def logged?; false end
def admin; false end