I have been trying to create a table in a pdf i am generating using Prawn gem in rails. I have been following some tutorial but when I try adding the table to the pdf I am getting the error '#<NoMethodError: undefined method `table' for #PdfMethods:0x0000023fc7b70648>'. Here is my code:
require "prawn"
class PdfMethods < Prawn::Document
def initialize
super
pdf_text
statement_accounts
end
def pdf_text
text "Order goes here", size: 40, style: :bold
end
def statement_accounts
move_down 20
table_data = Array.new
table_data << [[1, 2], [3, 4]]
table(table_data)
end
end
I have already installed both the prawn and prawn-table gems. Any help will be appreciated.
For many years (like since 1.2, so 7, 8 years?), table support has been in another gem called prawn-table, you'll need to have that in your project too, then
Prawn::Documentsupports thetablemethod. Maybe get a newer tutorial? ;)