[Backgroundrb-devel] Can BackgrounDrb help me?
ezmobius at gmail.com
Sun Feb 4 14:57:04 EST 2007
On Feb 4, 2007, at 11:38 AM, Robert Jones wrote:
> I have a big report to produce from a Rails app that takes several
> minutes to put together. I hoped backgroundrb would be able to
> pull together all the ActiveRecord stuff in the background then
> throw it back to Rails for rendering.
> It seems, however, that I can't pass an array of ActiveRecord
> objects from the worker back to Rails. Do I have that right?
> Another possibility was to do the rendering in the worker and send
> back a text variable. I got erb rendering working thanks to the
> tips from Jacob Robbins, but none of the ActionView helpers like
> "image_tag" are recognised. Can anyone tell me how to make that
> Any suggestions gratefully received.
> Robert Jones
It is best to avoid sending large objects or strings back and forth
between rails and bdrb because whatever you send across has to be
marshalled and unmarshalled.
I think you would be better off if you had bdrb save the array of AR
objects back into the database and then have drb send back an array
of id's of those objects. Then in rails you can grab them from the db
again and render.
Bdrb does not have access to rails controllers or views in the
normal way that rails does because it is not taking HTTP requests.
You are better off having bdrb do the heavy lifting and then let
rails do the rendering. But try to keep the objects you pass back and
forth as small as possible.
-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)
More information about the Backgroundrb-devel