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 happen? Any suggestions gratefully received. Robert Jones http://www.jonesieboy.co.uk/blog -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070204/0d70ec5e/attachment-0001.html
Hi Robert -- Can you elaborate a bit on what you are trying to do, exactly? What do you mean by "ActiveRecord stuff"? Mason On 2/4/07, Robert Jones <jonesieboy at gmail.com> 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 happen? > > Any suggestions gratefully received. > > Robert Jones > http://www.jonesieboy.co.uk/blog > > > > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070204/9c124df9/attachment.html
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 > happen? > > Any suggestions gratefully received. > > Robert Jones > http://www.jonesieboy.co.uk/blog >Robert- 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)