Home > OS >  Ruby on Rails Wicked PDF Template Missing Error
Ruby on Rails Wicked PDF Template Missing Error

Time:03-28

I am currently using rails 7 with wicked pdf . wicked pdf is throwing me an missing template error even if I have template file at exact place? what am i doing wrong?

  def show
   respond_to do |format|
    format.html
    format.pdf do
     render pdf: "file_name", template: "stocks/pdf.html.erb"
    end
   end
 end

what am i doing wrong ? I am using tailwindcss with jsbuild if that matters.

CodePudding user response:

in case your template is stocks/pdf.html.erb, your render should be as following:

format.pdf do
  render pdf: "file_name", template: "stocks/pdf", formats: [:html]
end

Let me know if this works for you.

Cheers

  • Related