2
votes

I'm trying to get PDF table to work ( following railscast example ) but i get the error undefined methodtable' for #

This is the pdf class lib (followed railscast way of doing) :

class FeedbackPdf < Prawn::Document
  def initialize
    super
      text_label
      pdf_feedbacks
  end

  def text_label
    text "Customers Feedback:"
  end

  def pdf_feedbacks
    table[[1,2],[3,4]]
  end
end

Can anyone help me please ?

2
not sure but in this doc I see example table(data, :header => true) It means that table is method which accepts some params. According to your code you try to call table[] or smth like this (I mean Ruby interprets your code in this way). Try to write table([[1,2],[3,4]]) - gotva
I did try table([],[]) but i still get the same error. - BC2

2 Answers

3
votes

According to this changelog, table is now disabled by default in prawn and will be moved in its own gem.

Until then, you can require it at the top of your file:

require "prawn/table"
0
votes

As of Prawn 1.2.0, Prawn::Table has been extracted into its own semi-officially supported gem.

Please see https://github.com/prawnpdf/prawn-table for more details.

Gemfile:

gem 'prawn-table'

Run:

bundle install

That should fix it. No need to

require "prawn/table"

any more.