On Dec 3, 1:07 pm, Dave Smith <[EMAIL PROTECTED]>
wrote:

> one final question.. i have the code working, and can send a mail
> template to a list of mailings... but in order to send more than one
> mailtemplate to these users i have had to create a button for each
> template as shown below..
>
> <% for mail_template in @mailinglist_templates %>
> <%= button_to "sendmail", { :action => "send_mail", :mail_template_id =>
> mail_template.id, :id => params[:id] } %>
> <% end %>
>
> now this i know is poor programming and looks bad too.. is there a way i
> can just have one button that sends each of the mail templates to all
> the users in the list..?

just call the action something like send_all_mails or something like
that and drop the :mail_template_id parameter and do that iteration
over all templates in the controller.

If you wanted to get a bit more fancy then you could have a checkbox
for each template you want to send (whether you have a list of
templates with a checkbox for each mailing list that should receive it
or a list of mailing list with checkboxes for each template that
should go to a  given mailing list is down to what makes the most
business sense to you)

Fred

>
> again many thanks for your help!!
> --
> Posted viahttp://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