Class: ReportMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/report_mailer.rb

Instance Method Summary collapse

Instance Method Details

#new_report(type, id) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/mailers/report_mailer.rb', line 4

def new_report(type, id)
  resource = {
    :url => report_index_url,
    :type => I18n.t('notifier.report_email.type.' + type),
    :id => id
  }
  Role.admins.each do |role|
    person = Person.find(role.person_id)
    if person.local?
      user = User.find_by_id(person.owner_id)
      unless user.user_preferences.exists?(:email_type => :someone_reported)
        resource[:email] = user.email
        format(resource).deliver
      end
    end
  end
end