'Ruby on Rails Wicked PDF Template Missing Error

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.



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zauzaj