Question

I have correct code, but Prawn complains to it:

class MyClass < Prawn::Document
  # ....
  def def123      
    table main_table , width: bounds.width 
  end

  def main_table
    [[ 
      "0","1", "2", "3", "4"
    ]] + 
    [
      [{content: "data1", colspan: 4}, "111"],
      [{content: "data2", colspan: 4}, "222"],
      [{content:"data3", colspan: 4}, "333"]
    ]
  end
end

by saying:

undefined method  colspan=  for Prawn::Table::Cell::Text:0x007fb86c3e7020

Note that I need to use width: bounds.width to be able to make the table fill a whole page.

prawn (0.12.0)

Was it helpful?

Solution

I'd recommend updating your Gem file to pull prawn directly from the git repository. Most undefined method errors are the result of using an out of date version:

gem 'prawn', :git => "https://github.com/prawnpdf/prawn.git"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top