Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/52.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 对虾中未定义的colspan方法_Ruby On Rails_Ruby_Prawn - Fatal编程技术网

Ruby on rails 对虾中未定义的colspan方法

Ruby on rails 对虾中未定义的colspan方法,ruby-on-rails,ruby,prawn,Ruby On Rails,Ruby,Prawn,我有正确的代码,但Prawn向它抱怨: 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"],

我有正确的代码,但Prawn向它抱怨:

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
请注意,我需要使用
width:bounds.width
才能使表格填充整个页面


prawn(0.12.0)

我建议更新您的Gem文件,以便直接从git存储库中提取prawn。大多数
未定义的方法
错误是使用过时版本的结果:


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

而对虾的版本是…?@zrl3dx-Prawn(0.12.0)正如下面有人在回答中所说,如果我没记错的话,请尝试使用最新版本,该函数是后来添加的。
undefined method  colspan=  for Prawn::Table::Cell::Text:0x007fb86c3e7020