@recipients = [invoice.approver_email,
invoice.alternate_approver_email].compact


On Tue, Nov 27, 2012 at 9:06 AM, KT <[email protected]> wrote:

> I have a Rails 3 app sending emails to multiple (2) recipients. The first
> recipient is required, but the second is not required. I get an error if
> the second recipient is null. How do I bypass the secondary email if null
> without getting an error?
>
>   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
>
> Thanks for your help!!
>
>  --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to