我有一个 Rails 3 应用程序向多个 (2) 收件人发送电子邮件。第一个收件人是必需的,但第二个不是必需的。如果第二个收件人为空,我会收到错误消息。如果为空,我如何绕过辅助电子邮件而不会出现错误?
def email_approvers(invoice)
@subject = 'Invoice Approval Request'
@body["invoice"] = invoice
@recipients = invoice.approver_email, invoice.alternate_approver_email
@from = "..."
@sent_on = Time.now
@headers = {}
end