[Backgroundrb-devel] Worker and ActiveRecord

Philip Lipu Tsai tsailipu at gmail.com
Wed Aug 9 01:33:46 EDT 2006


  Ezra or anyone experienced that may have the insight:

  When I first fetch an ActiveRecord model inside the Worker and
invoke a method in the model, which uses logger, why is it that the
logger is not defined?  This throws me off a bit as it seems that the
code space, e.g. Worker, would know about the Rails context?  Or this
is not the case?

 I notice that if the model is already fetched by the application
first (e.g. through a preceding web request that also fetches the same
model), then logger is defined when the model in the Worker accesses
the logger.   Seeing this, when I put "Rails::Initializer.run" atop my
Worker class, logger is then available when I first invoke that method
in the model....

 Thoughts?

 Thanks!
 Philip


More information about the Backgroundrb-devel mailing list