summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-08-31 06:06:43 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-08-31 06:06:43 +0000
commit17ec2a289f93f4ef1921a90e6ffd3e3815189bd8 (patch)
tree46c3392ce189ce0a91a9e58d229df36bd52c03eb /app
parentce24f4fb89a718696b9a0645a4929bf8427afe96 (diff)
downloadredmine-17ec2a289f93f4ef1921a90e6ffd3e3815189bd8.tar.gz
redmine-17ec2a289f93f4ef1921a90e6ffd3e3815189bd8.zip
Rails3: replace deprecated 'before_create' method at User model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6843 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 1c9c0131a..f9193778c 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -73,6 +73,7 @@ class User < Principal
validates_confirmation_of :password, :allow_nil => true
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
+ before_create :set_mail_notification
before_destroy :remove_references_before_destroy
named_scope :in_group, lambda {|group|
@@ -84,7 +85,7 @@ class User < Principal
{ :conditions => ["#{User.table_name}.id NOT IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id] }
}
- def before_create
+ def set_mail_notification
self.mail_notification = Setting.default_notification_option if self.mail_notification.blank?
true
end