So, I am using Delayed Jobs, and I am trying to figure out how to make all my mail programs linger. Right now, I put handle_asynchronously on all of my mailing list methods ... but I don't think this will work.
def first_notification(time) @time = time mail :to => time.person.email, :from => " email@example.com ", :subject => "#{time.person.name} wants to say hi" end handle_asynchronously :advisor_first_notification, :priority => 20
I don't think this will work, because I call it the following:
UserMailer.first_notification(@time).deliver
So how would he handle the .deliver part of this? I am getting an exception now.
EXCEPTION: #<ArgumentError: wrong number of arguments (1 for 0)>
Because of this, I feel that something is messed up in the delivery aspect.
I would prefer not to have a separate task file for each letter (since I have a lot of them), so is this the right way to handle this?
The only other possibility I can think of is to encapsulate calls to a method in my models and have them handle_asynchronously - so they can call the whole thing right away.
source share