Created
January 3, 2013 13:59
-
-
Save neilmiddleton/4443652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContactsController < ApplicationController | |
def create | |
@contact = Contact.new(params[:contact]) | |
if @contact.valid? | |
ContactMailManager.delay.send_contact_mail(@contact) | |
redirect_to contact_path(1), :notice => t("contact.sent") | |
else | |
... | |
end | |
end | |
end | |
class ContactMailManager | |
extend MailManager | |
def self.send_contact_mail(contact) | |
addresses = find_contact_recipients | |
addresses.each do |address| | |
::ContactsMailer.send_contact_mail(address,contact).deliver | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment