Topic: DelayedJob ion Rails 3: Exception NameError -> uninitialized constant

I'm building a Rails 3 app that uses delayed_job to schedule asynchronous tasks in the background.

It works fine when I use the .delay method or .handle_asynchronously to queue a job, but when I use a custom job it doesn't work.

This is what I have:

In my lib folder I have the Ruby class with the perform method in a file called my_job.rb that contains:

class MyJob < Struct.new(:text)
  def perform
    puts text
  end
end
and in my controller I have this:

Delayed::Job.enqueue MyJob.new('test')
When I call the controller I get the following error:

Exception NameError -> uninitialized constant Delayed::Job
Any ideas on how to solve this issue?

Re: DelayedJob ion Rails 3: Exception NameError -> uninitialized constant

This may just be a typo in your post on your part,  but it should look like:

Delayed::Job.enqueue(MyJob.new('test'))

That doesn't really explain your error message in my mind,  but just in case.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.