Hi all,
I am having some trouble with delaying a mailer using delayed_job.
I call the mailer from the controller thusly:
UserMailer.delay.standard_message(user, email)
The UserMailer class looks like this:
class UserMailer < ActionMailer::Base
include ActionView::Helpers::NumberHelper
default :from => "'Safrea' <
ad...@safrea.co.za>"
def standard_message(user, email)
@content = replace_tokens(email.body, user)
mail(:to => user.email, :subject => email.subject)
end
def replace_tokens(body, user)
<snipped>
end
end
Inspecting the delayed_job table, this is found in the handler field:
--- !ruby/struct:Delayed::PerformableMailer
object: !ruby/object:Class UserMailer
method_name: :standard_message
args:
- !ruby/object:User
attributes:
id: <id here>
email: <email address here>
<SNIP>
- !ruby/object:Email
attributes:
id: <id here>
subject: <subject here>
body: <SNIP>
The emails are not delivered, and I am left with the following error:
Class#standard_message failed with NoMethodError: undefined method
`standard_message' for #<Class:0xc4d360c>
Any help or pointers would be appreciated!
Thanks,
Marc