[Backgroundrb-devel] Using my models

Dave Dupre gobigdave at gmail.com
Fri Dec 21 13:36:40 EST 2007


That was it!  Now that I think of it, I think I made the same mistake with
the old version as well.

Thanks!  Now I can add the rest of my jobs.

Dave

On Dec 21, 2007 12:48 PM, Jason LaPier <jason.lapier at gmail.com> wrote:

> On Dec 21, 2007 9:14 AM, Dave Dupre <gobigdave at gmail.com> wrote:
> > I'm working on upgrading my app to the latest version of backgroundrb.
> > Everything went find until I tried to execute my tasks.
> >
> > Here is my simple worker for testing:
> >
> > class MscWorker < BackgrounDRb::MetaWorker
> >   set_worker_name :msc_worker
> >   def create(args = nil)
> >     # this method is called, when worker is loaded for the first time
> >   end
> >   # Send a message to everyone
> >   def send_message_to_all(args = nil)
> >     Message.send_to_everyone(args[:sender], args[:subject], args[:body],
> > false)
> >   rescue
> >     logger.error "MscWorker - #{err.class}: #{err}"
> >   end
> > end
> >
> > Called like so:
> > MiddleMan.ask_work(:worker => :msc_worker, :worker_method =>
> > :send_message_to_all, :data => { :sender => sender, :subject => subject,
> > :body => body })
> >
> > I get lots of errors starting with this:
> >
> /Users/dave/projects/backgroundrb1.0_msc/vendor/plugins/backgroundrb/server/master_worker.rb:31:in
> > `load': undefined class/module User (ArgumentError)
>
> I'm taking a wild guess here, but I think the problem may be in
> sending a user object to your worker via MiddleMan. Instead of using
> "sender", maybe try { :sender_id => sender.id } and in your worker
> look up the sender (i.e. sender = User.find(sender_id) ).
>
> - Jason L.
>
>
>
> --
> My Rails and Linux Blog: http://offtheline.net
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>



-- 
Dave Dupre
(m) 617-921-1684
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20071221/95df9562/attachment.html 


More information about the Backgroundrb-devel mailing list