From a296b1d6e31e377d6db46ee1aa7fc7a429bee158 Mon Sep 17 00:00:00 2001 From: spen Date: Mon, 22 Sep 2014 17:30:51 +0800 Subject: [PATCH] fix mail cron send mail del log --- app/mailer/mail_cron_mailer.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/mailer/mail_cron_mailer.rb b/app/mailer/mail_cron_mailer.rb index 3de6e63..31b50e5 100644 --- a/app/mailer/mail_cron_mailer.rb +++ b/app/mailer/mail_cron_mailer.rb @@ -63,7 +63,6 @@ class MailCronMailer < ActionMailer::Base end end - @mail_cron_log = { :mail_subject => @data.mail_subject, :mail_to => group_mail, @@ -74,10 +73,16 @@ class MailCronMailer < ActionMailer::Base @mail_cron_log = MailCronLog.new(@mail_cron_log) - @mail_cron_log.save - @data.destroy + @mail_to_count = @data.mail_to.split(',') - group_mail.split(',') + + if @mail_to_count.count == 0 + @data.destroy + else + @data.mail_to = @mail_to_count.join(',') + @data.save + end end