Using Rails view templates without the Controller? How?

Hi

I have a SupplierBreakdownReport class that uses a rails view to
generate a html report, which then is converted into a PDF, as follows :

class ReportGeneratorController < ApplicationController

..

def supplier_breakdown_report
  ...
  if request.post?
    @report =
SupplierBreakdownReport.new(@start_date,@end_date,params[:retailer_trivial_matrices])
    html = render_to_string :action=>"supplier_breakdown_report"
    pdf = generate_pdf(html)
    ...
  end
end

..

end

I now want to detach this report generation from the the Rails
controller so that I can generate these report in the background (maybe
using BackgroundDRB) without having to go through the rails controller.

I first though about using just ERB but this won't suffice as custom
rails methods like "render :partial=>...." wont work with ERB. I need
the full power of the rails templating system without going through the
controller.

Does anyone have any ideas how to do this? Any help is appreciated.

Thanks
Chris

Cells *might* work: http://cells.rubyforge.org/

Chris Richards wrote:

Hi

I have a SupplierBreakdownReport class that uses a rails view to
generate a html report, which then is converted into a PDF, as follows :

class ReportGeneratorController < ApplicationController

..

def supplier_breakdown_report
  ...
  if request.post?
    @report =
SupplierBreakdownReport.new(@start_date,@end_date,params[:retailer_trivial_matrices])
    html = render_to_string :action=>"supplier_breakdown_report"
    pdf = generate_pdf(html)
    ...
  end
end

..

end

I now want to detach this report generation from the the Rails
controller so that I can generate these report in the background (maybe
using BackgroundDRB) without having to go through the rails controller.

I first though about using just ERB but this won't suffice as custom
rails methods like "render :partial=>...." wont work with ERB. I need
the full power of the rails templating system without going through the
controller.

Does anyone have any ideas how to do this? Any help is appreciated.

Thanks
Chris

Why aren't you making the report available as an url? So you can have
the report at http://yourdomain/report and call this url from your
backgroundjob with

html = Net::HTTP.get('www.yourdomain.com', 'report')

Let Rails do its stuff the right way and just consume the outcome.
Not tested, but that would be my apporach.

Mike