[Backgroundrb-devel] Problems with ActiveRecord in workers

Ezra Zygmuntowicz ezmobius at gmail.com
Fri Jul 7 14:00:26 EDT 2006

On Jul 7, 2006, at 10:52 AM, Maximilian Schöfmann wrote:

> Hi *,
> are there some special settings except of "load_rails: true" to make
> ActiveRecord models accessible within my workers?
> I've just installed the latest version of this great plugin, but I  
> keep
> getting
>   undefined method [] for #<DRb::DRbUnknown:0x12345> (line 105 in
> backgroundrb.rb)
> when one of the arguments for the worker is an ActiveRecord object.
> I assume that the MiddleMan somehow doesn't see my models. I have
> already tried to put
>   model :blabla, :foo, :bar
> in application.rb, but this didn't help.
> Any ideas?
> Regards,
> Max

Hey Max-

	If you need to pass an active record object to one of your workers  
as an argument then you need to add one line of code to each model  
that you intend on using this way. So if the model you want to send  
from rails to the drb server is Post then you need to add this line:

class Post < ActiveRecord::base

   include DRbUndumped

#the rewst of your code


	If you add that to the models you need to send to the drb server it  
will work.


More information about the Backgroundrb-devel mailing list