ruby-on-rails-4 - Prawn gem未定义方法 `table' for #<FeedbackPdf>

标签 ruby-on-rails-4 prawn ruby-2.1

我正在尝试让 PDF 表正常工作(以下为 Railscast 示例),但我收到错误 undefined methodtable' for #

这是 pdf 类库(遵循 Railscast 的做法):

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

有人可以帮我吗?

最佳答案

根据这个changelog ,表现在在 prawn 中默认禁用,并将在其自己的 gem 中移动。

在那之前,您可以在文件顶部引用它:

require "prawn/table"

关于ruby-on-rails-4 - Prawn gem未定义方法 `table' for #<FeedbackPdf>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24710340/

相关文章:

mysql - 将参数发送到 ROR 中的存储过程的安全方法

ruby-on-rails - Rails 加入排除某些 ID

ruby-on-rails - Prawn 不会画横线

ruby - 构建最新的 ruby​​ 失败 : use of undeclared identifier 'YAML_VERSION_*'

ruby-on-rails - Ruby 2.0.0,而不是 Rails 站点上推荐的 2.1.0?

ruby - ruby 2.1 上的私有(private) def 错误

ruby-on-rails - Rails has_many :through validation nested records count by specific param

ruby - 使用 Prawn Ruby 库时的当前光标位置

ruby-on-rails - Prawn 使用pdf模板

ruby-on-rails - Rails 直播不工作(卡住请求)