Reputation: 2728
I try to use rails prawn template style. In my main prawn document "order_summary", I want to render a prawn template like this:
pdf = Prawn::Document.new(:page_size => "A4")
render :partial => "invoice"
The name of the partial is: _invoice.pdf.prawn and resides in the very same folder as the main document.
When running it, it results in a blank page. The page was rendered successfully according to the logs:
Rendered documents/_invoice.pdf.prawn (756.7ms) Rendered documents/order_summary.pdf.prawn (1100.9ms) Completed 200 OK in 2323ms (Views: 1141.1ms | ActiveRecord: 0.4ms)
If I run the partial as "invoice.pdf.prawn" (without rendering it through another file), it works fine so I assume there is no code error or sth.
What do I do wrong?
Upvotes: 3
Views: 1342
Reputation: 133
This is a gotcha documented in the Prawnto wiki. Even if the partial is in the same folder, you still have to specify the full path. In your case, 'documents/invoice'.
Upvotes: 3