Topic: Undefined method delayed jobs

Hi there !

I'm new to RoR, and I need to delay my mailing tasks, to gain loading time on my website

I'm running Rails 2.1.2. I've decided to use the gem delayed_jobs(version 2.0.4), since it seemed (in theory) quite easy to run.

After some googling, I havent found anything helpful, that's why I came here. Here's the commented line, and the error message returned after execution :

Line where the error occurs :

UserMailer.send_later(:deliver_send_contact_form_to, "#{}", "", subject, "#{body}#{cu}" )

Error returned :

undefined method `deliver_send_contact_form_to' for UserMailer

I'm pretty sure deliver_send_contact_form_to is defined, since it worked perfectly before I used delayed jobs. I think it might be some kind of syntax error, but I'm not sure yet. I dont really know what to do now...

I can show you more of the source if you need to. Any help would be welcome smile

Re: Undefined method delayed jobs

Hi Moctian,

Rails version 2.1.2 is very old so this could be a interaction/bug between older rails and the newer delayed_job.

From a rails console (script/console) are you able to run the following without error?

UserMailer.deliver_sent_contact_form_to("", "", "Test Subject", "Test body").deliver

Re: Undefined method delayed jobs

Hi pglombardo, and thanks for helping me smile

I tried to run the console with your command, the following error occurs :

NoMethodError: undefined method `deliver' for #<TMail::Mail:0xb5c08cac>

About my Rails version, it's indeed quite old, but I took care to get a compatible delayed_jobs version. I've read that v2.0.4 is compatible with Rails version 2.x.

Re: Undefined method delayed jobs

That is correct. I am using RoR 2.3.8 and DJ 2.0.4 and they work fine together. DJ is a great choice.

'send_later' is deprecated, use 'delay'.

# Notifier is my mailer
# Notifier.send_later(:deliver_create_user, self)

Are you able to execute 'rake jobs:clear' or 'rake jobs:work'?