Multiple email recipients

I’m trying to call multiple email addresses from database. But dont
know how to get the logic into the recipients field.

#subscriptions_controller
def deliver
@subscription = Subscription.find(params[:id])
@users = @subscription.users
@subscription_recipients = @users.find(:all).collect { |user|
user.email }
@subscription.deliver
flash[:notice] = “Delivered Subscription”
redirect_to subscriptions_url
end

#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

You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

depassion wrote:

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?

depassion wrote:

#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}