Skip to content

Commit

Permalink
send to mailing list
Browse files Browse the repository at this point in the history
  • Loading branch information
genya0407 committed Dec 13, 2017
1 parent d6c22c3 commit 5f0647d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/mailers/notify_lack_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class NotifyLackMailer < ApplicationMailer
def lack_exist_email(user, cars)
def lack_exist_email(cars)
@cars = cars
subject = if cars.empty?
'乗車記録に欠落はありません'
else
'乗車記録に欠落があります'
end
mail(:to => user.email,
mail(:to => Rails.application.secrets.mailing_list_address,
:subject => subject)
end
end
1 change: 1 addition & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ production:
sendgrid_api_key: <%= ENV['SEND_GRID_API_KEY'] %>
domain: <%= ENV['MAIL_DOMAIN'] %>
site_domain: <%= ENV['SITE_DOMAIN'] %>
mailing_list_address: <%= ENV['MAILING_LIST_ADDRESS'] %>
4 changes: 1 addition & 3 deletions lib/tasks/check_drive_lack.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ task check_drive_lack: :environment do
car.drives.only_checked.lack_exist?
end

User.admin.each do |user|
NotifyLackMailer.lack_exist_email(user, cars_with_lack).deliver_now
end
NotifyLackMailer.lack_exist_email(cars_with_lack).deliver_now
end

0 comments on commit 5f0647d

Please sign in to comment.