Closed dashbitla closed 8 years ago
class EmailWorker
include SuckerPunch::Job
def perform(klass, name, *args)
klass.constantize.send(name.to_sym, *args).deliver
end
end
and use:
EmailWorker.perform_async(ETicketMailer, :new_coupon_code, searchbus, coupon_id)
EmailWorker.perform_async(ETicketMailer, :cancel_tickets, ticket_ids, coupon_id)
EmailWorker.perform_async(ETicketMailer, :request_seat, o_request_id)
On Rails 3.2!
What is the best way to use sucker_punch for emailing? How do we define methods and how do we call it when we have multiple mail methods in the Mailer class?
Our Mailer Class has about 100+ different email methods such as:
How to convert this to sucker_punch? Whats the easiest way?
It doesn't make sense to create separate Job class for each mail method!
Whats the best way to use sucker_punch for mailers?