2
哪一個會是首選?在ActionMailer模型動作中發送多個郵件方法是好的做法,還是應該將這個邏輯放在Mailer動作之外?
class Mailer < ActionMailer::Base
# this?
def bid_end_notify_failed_bidders(job)
@job = job
bidders = @job.bidders
bidders.delete(@job.winner)
bidders.each do |t|
mail(:to => t.email, ....)
end
end
# or this?
def notify_failed_bid(bidder)
mail(:to => bidder ...)
end
end