我有一个actinmailer方法,如果@receiver
符合某些条件并且有@default_mail
,则会填充to
。它将邮件发送到BCC中的接收者和def mail_users
@default_mail = "user@gmail.com"
@latest_listing_mail= Equipment.joins(:user).last.user.email
@wanted_req_mail = WantedEquipment.where(sub_category_id: "#{a}", status: 2).pluck(:email)
@wanted_req_mail.include? @latest_listing_mail
if true
@receiver = @wanted_req_mail.delete(@latest_listing_mail)
@receiver = @wanted_req_mail
mail(bcc: @receiver, to: @default_mail)
end
end
字段中的default_mail。它如下:
mail
如果@receiver
为空,我不希望scipy.sparse.save_npz
执行。我如何实现这一目标?
答案 0 :(得分:1)
只需添加条件
mail(bcc: @receiver, to: @default_mail) if @receiver.present?
你可能想删除这个条件
if true # doesn't make sense
end