0

嗨,我正在尝试阅读 RoR 3.2.8 中的 pfd,因为我这样做了:

gem install pdf-toolkit

我将 gem 添加到 Gemfile:gem "pdf-toolkit", "0.5.0"

在我进行了捆绑安装并且一切正常之后,现在当我尝试执行我的程序时,我得到了这个错误:NoMethodError: undefined method class_inheritable_accessor’ for PDF::Toolkit:Class

我一直在寻找解决方案,但不幸的是我无法解决它,有什么想法吗?谢谢!

这是我的代码的一部分:

require 'rubygems'
require 'pdf/toolkit'

class Terminations
  def initialize
    @seperator = " "
    #@extract_file = "/uploads/Test and rates.pdf"
  end
..
...
end
4

1 回答 1

3

The method class_inheritable_accessor was removed from ActiveSupport in Rails 3.2. The version of pdf-toolkit you are attempting to use was released in 2006 and it doesn't look like it's even being maintained anymore. There is a 1.0 release candidate that was published in Feb. 2012 that you could try, but I wouldn't recommend depending on an abandoned gem for production use. The github README says the following:

This is a prerelease 1.0.0.rc1 version on an almost abandonned project. The main difference (broken API) with the 0.5.0 branch is that support for ActiveRecord has been entirely removed (mostly because the implementation was ugly so far). If you use pdf-toolkit and would like activerecord to be included in 1.0.0, please just tell us and we'll add it. If you upgrade from 0.5.0 to 1.0.0.rc1 and something else goes wrong, please report the issue on github.

于 2012-11-23T14:36:37.927 回答