Sweet - thank you.

I forgot that I have a method in my invoice model to append the email 
address to the alternate_approver_username.  How do I ignore that method if 
alternate_approver_username is null?  Do I use: if 
alternate_approver_username.present?

*def alternate_approver_email
    self.alternate_approver_email = self.alternate_approver_username + 
"@sandiego.gov"
end*

On Tuesday, November 27, 2012 9:13:54 AM UTC-8, James Miller wrote:
>
> @recipients = [invoice.approver_email, 
> invoice.alternate_approver_email].compact
>
>
> On Tue, Nov 27, 2012 at 9:06 AM, KT <[email protected] <javascript:>>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] <javascript:>
>> http://groups.google.com/group/sdruby
>
>
>

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

Reply via email to