Tiberiu Motoc
2007-Jun-25 00:28 UTC
[Backgroundrb-devel] one more "uninitialized constant" problem
Hi everyone,
I''m new to backgroundrb, and I''m trying to get started with
a simple example, yet with no success.
This is the code that I have in RAILS_ROOT/lib/workers/testing_worker.rb
class TestingWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
# This method is called in it''s own new thread when you
# call new worker. args is set to :args
logger.info(''TestingWorker do work'')
results[:do_work_time] = Time.now_to_s
results[:done_with_do_work] || = true
end
end
And this is the code that I have in
RAILS_ROOT/app/controllers/mytest2_controller.rb
class Mytest2Controller < ApplicationController
def new
key = MiddleMan.new_worker(:class => :testing_worker)
worker = MiddleMan.worker(key)
#worker.other_method
#worker.delete
end
end
And this is what I get when I access: http://host:3000/mytest2/new
NameError in Mytest2Controller#new
uninitialized constant TestingWorker
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
I don''t understand why I''m getting the "uninitialized
constant" error. I''ve read other postings with the same issue, and
I understand that you must restart the server after adding/making modifications
to your workers. The server is restarted with the following commands:
./script/backgroundrb stop and ./script/bacgroundrb start, right? (I
don''t even think this applies to me, since first I created all
necessary files for the example and then I started the server; I did restart the
server several times just to make sure this is not a problem)
I also tried to use the console and I get a similar message.
Btw, I have changed nothing in the default setup, except in
/server/lib/backgroundrb/console.rb, where I commented out the line
"require ''irb/completion''" due to a strange error
that I was getting.
Thanks,
Tiberiu
PS. I want to make sure that the way I downloaded backgroundrb is not faulty.
Instead of getting it via subversion (trying to save time by not involving my
admin), I just downloaded file by file from
http://svn.devjavu.com/backgroundrb/tags/release-0.2.1.
---------------------------------
Ask a question on any topic and get answers from real people. Go to Yahoo!
Answers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070624/05ee1b56/attachment-0001.html
Geoff Garside
2007-Jun-25 07:42 UTC
[Backgroundrb-devel] one more "uninitialized constant" problem
On 25 Jun 2007, at 01:28, Tiberiu Motoc wrote:> Hi everyone, > > I''m new to backgroundrb, and I''m trying to get started with a > simple example, yet with no success. > > This is the code that I have in RAILS_ROOT/lib/workers/ > testing_worker.rb > class TestingWorker < BackgrounDRb::Worker::RailsBase > def do_work(args) > # This method is called in it''s own new thread when you > # call new worker. args is set to :args > logger.info(''TestingWorker do work'') > results[:do_work_time] = Time.now_to_s > results[:done_with_do_work] || = true > end > endDo you have TestingWorker.register at the end of the testing_worker.rb file?> > And this is the code that I have in RAILS_ROOT/app/controllers/ > mytest2_controller.rb > class Mytest2Controller < ApplicationController > def new > key = MiddleMan.new_worker(:class => :testing_worker) > worker = MiddleMan.worker(key) > #worker.other_method > #worker.delete > end > end > > And this is what I get when I access: http://host:3000/mytest2/new > NameError in Mytest2Controller#new > uninitialized constant TestingWorker > RAILS_ROOT: script/../config/.. > Application Trace | Framework Trace | Full Trace > > I don''t understand why I''m getting the "uninitialized constant" > error. I''ve read other postings with the same issue, and I > understand that you must restart the server after adding/making > modifications to your workers. The server is restarted with the > following commands: ./script/backgroundrb stop and ./script/ > bacgroundrb start, right? (I don''t even think this applies to me, > since first I created all necessary files for the example and then > I started the server; I did restart the server several times just > to make sure this is not a problem) > I also tried to use the console and I get a similar message. > Btw, I have changed nothing in the default setup, except in /server/ > lib/backgroundrb/console.rb, where I commented out the line > "require ''irb/completion''" due to a strange error that I was getting. > > Thanks, > Tiberiu > > PS. I want to make sure that the way I downloaded backgroundrb is > not faulty. Instead of getting it via subversion (trying to save > time by not involving my admin), I just downloaded file by file > from http://svn.devjavu.com/backgroundrb/tags/release-0.2.1. > > Ask a question on any topic and get answers from real people. Go to > Yahoo! Answers. > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-develRegards, Geoff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070625/2398907d/attachment.html
Tiberiu Motoc
2007-Jun-25 17:52 UTC
[Backgroundrb-devel] one more "uninitialized constant" problem
Hi Geoff,
Yes, I do have it at the end of the script. I just forgot to copy it in the
message.
Tiberiu
Geoff Garside <ruby at geoffgarside.co.uk> wrote:
On 25 Jun 2007, at 01:28, Tiberiu Motoc wrote:
Hi everyone,
I''m new to backgroundrb, and I''m trying to get started with
a simple example, yet with no success.
This is the code that I have in RAILS_ROOT/lib/workers/testing_worker.rb
class TestingWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
# This method is called in it''s own new thread when you
# call new worker. args is set to :args
logger.info(''TestingWorker do work'')
results[:do_work_time] = Time.now_to_s
results[:done_with_do_work] || = true
end
end
Do you have
TestingWorker.register
at the end of the testing_worker.rb file?
And this is the code that I have in
RAILS_ROOT/app/controllers/mytest2_controller.rb
class Mytest2Controller < ApplicationController
def new
key = MiddleMan.new_worker(:class => :testing_worker)
worker = MiddleMan.worker(key)
#worker.other_method
#worker.delete
end
end
And this is what I get when I access: http://host:3000/mytest2/new
NameError in Mytest2Controller#new
uninitialized constant TestingWorker
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
I don''t understand why I''m getting the "uninitialized
constant" error. I''ve read other postings with the same issue, and
I understand that you must restart the server after adding/making modifications
to your workers. The server is restarted with the following commands:
./script/backgroundrb stop and ./script/bacgroundrb start, right? (I
don''t even think this applies to me, since first I created all
necessary files for the example and then I started the server; I did restart the
server several times just to make sure this is not a problem)
I also tried to use the console and I get a similar message.
Btw, I have changed nothing in the default setup, except in
/server/lib/backgroundrb/console.rb, where I commented out the line
"require ''irb/completion''" due to a strange error
that I was getting.
Thanks,
Tiberiu
PS. I want to make sure that the way I downloaded backgroundrb is not faulty.
Instead of getting it via subversion (trying to save time by not involving my
admin), I just downloaded file by file from
http://svn.devjavu.com/backgroundrb/tags/release-0.2.1.
---------------------------------
Ask a question on any topic and get answers from real people. Go to Yahoo!
Answers. _______________________________________________
Backgroundrb-devel mailing list
Backgroundrb-devel at rubyforge.org
http://rubyforge.org/mailman/listinfo/backgroundrb-devel
Regards,
Geoff
---------------------------------
All new Yahoo! Mail
---------------------------------
Get news delivered. Enjoy RSS feeds right on your Mail page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070625/064ea1a8/attachment.html
Geoff Garside
2007-Jun-25 19:31 UTC
[Backgroundrb-devel] one more "uninitialized constant" problem
Ah, think I see it now. Try changing your TestingWorker to use Time.now.to_s not Time.now_to_s. If you check the backgroundrb log files you will probably see a no method error somewhere. Geoff On 25 Jun 2007, at 18:52, Tiberiu Motoc wrote:> Hi Geoff, > > Yes, I do have it at the end of the script. I just forgot to copy > it in the message. > > Tiberiu > > Geoff Garside <ruby at geoffgarside.co.uk> wrote: > On 25 Jun 2007, at 01:28, Tiberiu Motoc wrote: > >> Hi everyone, >> >> I''m new to backgroundrb, and I''m trying to get started with a >> simple example, yet with no success. >> >> This is the code that I have in RAILS_ROOT/lib/workers/ >> testing_worker.rb >> class TestingWorker < BackgrounDRb::Worker::RailsBase >> def do_work(args) >> # This method is called in it''s own new thread when you >> # call new worker. args is set to :args >> logger.info(''TestingWorker do work'') >> results[:do_work_time] = Time.now_to_s >> results[:done_with_do_work] || = true >> end >> end > > Do you have > > TestingWorker.register > > at the end of the testing_worker.rb file? > >> >> And this is the code that I have in RAILS_ROOT/app/controllers/ >> mytest2_controller.rb >> class Mytest2Controller < ApplicationController >> def new >> key = MiddleMan.new_worker(:class => :testing_worker) >> worker = MiddleMan.worker(key) >> #worker.other_method >> #worker.delete >> end >> end >> >> And this is what I get when I access: http://host:3000/mytest2/new >> NameError in Mytest2Controller#new >> uninitialized constant TestingWorker >> RAILS_ROOT: script/../config/.. >> Application Trace | Framework Trace | Full Trace >> >> I don''t understand why I''m getting the "uninitialized constant" >> error. I''ve read other postings with the same issue, and I >> understand that you must restart the server after adding/making >> modifications to your workers. The server is restarted with the >> following commands: ./script/backgroundrb stop and ./script/ >> bacgroundrb start, right? (I don''t even think this applies to me, >> since first I created all necessary files for the example and then >> I started the server; I did restart the server several times just >> to make sure this is not a problem) >> I also tried to use the console and I get a similar message. >> Btw, I have changed nothing in the default setup, except in / >> server/lib/backgroundrb/console.rb, where I commented out the line >> "require ''irb/completion''" due to a strange error that I was getting. >> >> Thanks, >> Tiberiu >> >> PS. I want to make sure that the way I downloaded backgroundrb is >> not faulty. Instead of getting it via subversion (trying to save >> time by not involving my admin), I just downloaded file by file >> from http://svn.devjavu.com/backgroundrb/tags/release-0.2.1. >> >> Ask a question on any topic and get answers from real people. Go >> to Yahoo! Answers. >> _______________________________________________ >> Backgroundrb-devel mailing list >> Backgroundrb-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > Regards, > Geoff > > > > All new Yahoo! Mail > Get news delivered. Enjoy RSS feeds right on your Mail page.-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070625/db007678/attachment.html