Sunday 15 March 2015

ruby - Render PDF on custom controller action using wicked_pdf -



ruby - Render PDF on custom controller action using wicked_pdf -

this may end beingness simple have been trying figure out no avail. using wicked_pdf render pdfs on html pages. when restful way adding respond_to block controllers show action works fine when going controller/id.pdf.

what trying however, utilize respond_to block on custom controller action. have reports controller has many reports , custom actions. 1 of these reports has form submitted custom controller action render report. works fine html render however, when added respond_to block custom action tells me cannot find show action controller. below related code:

routes.rb

resources :reports collection 'customer_summary' post 'summary_report' end end

reports_controller.rb

def summary_report @tickets = tickets respond_to |format| format.html format.pdf render pdf: "summary_report", header: {spacing: 10, html: {template: 'shared/header'}}, footer: {html: {template: 'shared/footer'}}, margin: { top: 20, bottom: 20 } end end

the templates exsist summary_report.pdf.haml file. doing wrong? give thanks in advance help!

ruby ruby-on-rails-3.2 wicked-pdf

No comments:

Post a Comment