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.
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