[Backgroundrb-devel] 'uninitialized constant' error

Ezra Zygmuntowicz ezmobius at gmail.com
Mon Jul 10 17:21:18 EDT 2006


On Jul 10, 2006, at 1:39 PM, Aravind Elango wrote:

> Hi All,
>
> I am fairly new to Ruby and backgroundRB.  I am trying to run a  
> simple example in Windows to get my feet wet with backgroundRB and  
> am running into an 'uninitialized constant' error when I invoke the  
> controller on my rails app.
>
> In 'MyTest' Controller
> -------------------
> def longrun
>       session[:job_key] = MiddleMan.new_worker(:class  
> => :tail_worker, :args => {:baz => 'hello!', :qux => 'another arg!'})
>   end
>
> In cookbook\lib\workers\tail_worker.rb
> -----------------------------------------------
> class TailWorker < BackgrounDRb::Rails
>   def do_work(args)
>     puts "Printing from inside TailWorker::do_work()"
>   end
> end
>
>
> When I issue the request to
> http://127.0.0.1:3000/My_Test/longrun
> I get the following error:
> NameError in My testController#longrun
> uninitialized constant TailWorker
>
>
> I'd appreciate any light thrown on what I might have done to cause  
> this error and about how to rectify it.
>
> Thanks,
> Aravind Elango

Hi Aravind and welcome ;) Your code looks like it should work fine.  
Did you make sure to restart the backgroundrb server after you added  
the tails_worker.rb file to lib/workers? That could cause this error.

Cheers-
-Ezra


More information about the Backgroundrb-devel mailing list