@@ -73,6 +73,7 class User < Principal | |||||
73 | validates_confirmation_of :password, :allow_nil => true |
|
73 | validates_confirmation_of :password, :allow_nil => true | |
74 | validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true |
|
74 | validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true | |
75 |
|
75 | |||
|
76 | before_create :set_mail_notification | |||
76 | before_destroy :remove_references_before_destroy |
|
77 | before_destroy :remove_references_before_destroy | |
77 |
|
78 | |||
78 | named_scope :in_group, lambda {|group| |
|
79 | named_scope :in_group, lambda {|group| | |
@@ -84,7 +85,7 class User < Principal | |||||
84 | { :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] } |
|
85 | { :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] } | |
85 | } |
|
86 | } | |
86 |
|
87 | |||
87 | def before_create |
|
88 | def set_mail_notification | |
88 | self.mail_notification = Setting.default_notification_option if self.mail_notification.blank? |
|
89 | self.mail_notification = Setting.default_notification_option if self.mail_notification.blank? | |
89 | true |
|
90 | true | |
90 | end |
|
91 | end |
General Comments 0
You need to be logged in to leave comments.
Login now