Unitialize variable delayed_job

My code:

path: app_root\lib\my_worker.rb

module MyModule
require “delayed_job”
class MyWorker < Delayed::Worker
def perform
while true do
puts “I am my worker!!!”
sleep 2

def create_job
 # MyWorker.enqueue



Path: app_root\my_script.rb

require “./lib/my_worker”
require “delayed_job”
require “rubygems”

class MyScript
m = MyModule::MyWorker.new

when i am trying to run my_script.rb file from cmd it gives me error

C:\my_delayed_job>ruby my_script.rb
internal:lib/rubygems/custom_require:29:in `require’: no such file to

C:/my_delayed_job/my_script.rb/delayed_job (LoadError)
from internal:lib/rubygems/custom_require:29:in require' from my_script.rb:4:in

Can any body resolve this problem?

On 13 May 2011, at 14:44, News A. wrote:

Can any body resolve this problem?

Did you include the delayed_job gem requirement in your Gemfile
(assuming that you are on Rails 3)?

One more remark: when you include the gem in your Gemfile, you have
two options:

  1. Load gem at start

gem “delayed_job”

This will already require the gem and it will be available for your
whole application

  1. Require in specific places

gem “delayed_job”, :require => nil

This will prevent the gem from being required at the start of your
application and you’ll need to require it yourself where applicable.

Unless you have a very good reason for not doing so, you should go for
option 1.

If this is not your problem, I’m suspecting Windows might be it and
the gem isn’t compatible with Windows (another reason to do Rails
development in a Linux VM).

Best regards

Peter De Berdt

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs