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|
{ :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