1 class AdminNotifier < ActionMailer::Base
2 default from: Rails.configuration.admin_notifier_email_from
4 def after_create(model, *args)
5 self.generic_callback('after_create', model, *args)
10 def generic_callback(callback_type, model, *args)
11 model_specific_method = "#{callback_type}_#{model.class.to_s.underscore}".to_sym
12 if self.respond_to? model_specific_method
13 self.send model_specific_method, model, *args
17 def all_admin_emails()
19 where(is_admin: true).
23 select { |e| e.match /\@/ }
26 def after_create_user(user, *args)
28 logger.info "Sending mail to #{@recipients} about new user #{@new_user.uuid} (#{@new_user.full_name}, #{@new_user.email})"
30 to: self.all_admin_emails,
31 subject: "#{Rails.configuration.email_subject_prefix}New user: #{@new_user.full_name}, #{@new_user.email}"