Frederick Cheung wrote:
> On 2 Dec 2008, at 13:26, Dave Smith wrote:
> 
>>>>> Fred
>>> button_to :send_mail, :id => some_template.id, :mailing_list_id =>
>>>   end
>> mailings (database table shown below).
>>    @mail_template = MailTemplate.find(params[:id])
>>    @mailing_list = MailingList.find(params[:mailing_list_id])
> 
>>    @mailinglist_mailings = @mailinglist.mailings.collect
> 
> This line above is pointless. collect with no block passed just
> returns the original array.
> THe point of collect/map is to create a new collection by applying a
> function to each element (eg given an array of numbers construct an
> array with the square of each number: numbers.collect {|n| n*n} )
> 
> @mailing_list.mailings.each do |mailing|
>     Emailer.deliver_contact(mailing.email_address,
> @mail_template.subject, @mail_template.body)
> end
> 
> 
> Fred

yep brilliant, a few tweaks here and there and ive got it running. Thank 
you very much for your help!

Kindest Regrds

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to