#subscription.rb
def deliver
UserMailer.deliver_lotto_saturday_subscription(@user, @subscription)
update_attribute(:schedule_delivery, Time.now)
end
#user_mailer.rb
class UserMailer < ActionMailer ::Base
def lotto_saturday_subscription(user, subscription)
@recipients = ???
from "lottomail.net"
subject "Your Lotto Saturday Reminder"
body :user => user
end
I'm trying to call multiple email addresses from database. But dont
know how to get the logic into the recipients field.
def lotto_saturday_subscription(user, subscription)
@recipients = ???
from "lottomail.net"
subject "Your Lotto Saturday Reminder"
body :user => user
end
This is kind of a shot in the dark, but .. When I have to hold several
items, I make a list, also called an array, of elements.
Have you tried that?
#user_mailer.rb
class UserMailer < ActionMailer ::Base
def lotto_saturday_subscription(user, subscription)
@recipients = ???
from "lottomail.net"
subject "Your Lotto Saturday Reminder"
body :user => user
end
Something along the lines of: user.all.collect{|user| user.email}