Aravind Elango
2006-Jul-10 20:39 UTC
[Backgroundrb-devel] ''uninitialized constant'' error
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
Ezra Zygmuntowicz
2006-Jul-10 21:21 UTC
[Backgroundrb-devel] ''uninitialized constant'' error
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 ElangoHi 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
Aravind Elango
2006-Jul-11 00:01 UTC
[Backgroundrb-devel] ''uninitialized constant'' error
Gotcha. Restarting the server worked. Thanks Ezra :-) -Aravind>>> Ezra Zygmuntowicz <ezmobius at gmail.com> 07/10/06 5:21 PM >>>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 ElangoHi 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