undefined method `table' for #<Prawn::Document:0xca98060>

347 views
Skip to first unread message

Chee Chong Hwa

unread,
Feb 5, 2017, 11:44:33 PM2/5/17
to Prawn
Hi Alexander

I went through the Railscast #153 on using Prawn but the code

pdf.table Payslip generates the error undefined method `table' for #<Prawn::Document:0xca98060>
What can I do to continue ?


NoMethodError in Payslips#to_pdf

Showing C:/RubymineProjects/pms4mysql/app/views/payslips/to_pdf.pdf.prawn where line #24 raised:

undefined method `table' for #<Prawn::Document:0xca98060>
Extracted source (around line #24):
22
23
24
25
26
27
              
pdf.table Payslip, :border_style => :grid,
:row_colors => ["FFFFFF","DDDDDD"],
:headers => ["Employee #", "Name", "Dept", "Net Pay"],
:align => { 0 => :left, 1 => :right, 2 => :right, 3 => :right }

Alexander Mankuta

unread,
Feb 6, 2017, 4:17:43 AM2/6/17
to prawn...@googlegroups.com

Prawn-related Railscasts episodes are pretty old. They definitely use pre-1.0 version of Prawn. Prawn has changed a lot since then. One of the changes is extraction of tables into their own gem (prawn-table).

If your goal is to just replicate the code from the screencasts I'd suggest using an older version of Prawn. Find the one that was the latest at the time of the episode you're working through was released and use that.

If your goal is to write some production code I'd suggest you adapting the code to the latest version of Prawn as those old versions are not supported any more.



--
Regards,
Alexander
--
You received this message because you are subscribed to the Google Groups "Prawn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prawn-ruby+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Chee Chong Hwa

unread,
Feb 6, 2017, 7:04:05 AM2/6/17
to prawn...@googlegroups.com
Hi Alexander

TQVM for your advice to use the latest.
Found an updated version of Railcast 153 which worked with Rails 5 + Latest Prawn.
Have downloaded the source and now studying the changes.

Cheers


To unsubscribe from this group and stop receiving emails from it, send an email to prawn-ruby+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Prawn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prawn-ruby/2Rr0uv1XxFg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prawn-ruby+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages