11175
(-- --)
1
I have a list of 3 "report_admins" in my database, and when I send an
email I need to email to go to all 3 admins,
So in the controller I put...
@report_admins = ReportAdmin.find(:all)
Then I told ActionMailer this...
@recipients = report_admins.email
But when I try and send this email I get this error...
undefined method `email' for #<Array:0x455e214>
I have been told that I need to change this array into a string, but I
don't know how... How?
Andrew
11175
(-- --)
3
babu nair wrote:
Hi you can try like this
@report_admins = ReportAdmin.find(:all)
@recipients=
for report_admin in @report_admins
@recipients << report_admin.email
end
You can collect the email address of each admin in one line:
@recipients = @report_admins.collect { |a| a.email }
11175
(-- --)
4
Andrew Doades wrote:
I have a list of 3 "report_admins" in my database, and when I send an
email I need to email to go to all 3 admins,
So in the controller I put...
@report_admins = ReportAdmin.find(:all)
Then I told ActionMailer this...
@recipients = report_admins.email
But when I try and send this email I get this error...
undefined method `email' for #<Array:0x455e214>
I have been told that I need to change this array into a string, but I
don't know how... How?
Andrew
Hi
when you write ReportAdmin.find(:all) it gives array as result. so u
access each record through
11175
(-- --)
5
Andrew Doades wrote:
I have a list of 3 "report_admins" in my database, and when I send an
email I need to email to go to all 3 admins,
So in the controller I put...
@report_admins = ReportAdmin.find(:all)
Then I told ActionMailer this...
@recipients = report_admins.email
But when I try and send this email I get this error...
undefined method `email' for #<Array:0x455e214>
I have been told that I need to change this array into a string, but I
don't know how... How?
Andrew
Hey I am facing same problem
what to do ?