2012-11-23 61 views
0

你好我想在回報率3.2.8閱讀PFD,爲我所做的:NoMethodError:未定義的方法class_inheritable_accessor」爲PDF ::工具包:Class`

gem install pdf-toolkit 

我加入了寶石的的Gemfile:gem "pdf-toolkit", "0.5.0"

後,我做了一個捆綁安裝和一切工作,鑽現在當我嘗試執行我的計劃,我得到這個錯誤:NoMethodError: undefined method class_inheritable_accessor’ for PDF::Toolkit:Class

我一直在尋找一個解決方案,但不幸的是我不能解決它,有什麼想法?謝謝!

這裏是我的代碼PICE:

require 'rubygems' 
require 'pdf/toolkit' 

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

回答

3

的方法class_inheritable_accessor是removed from ActiveSupport in Rails 3.2。您試圖使用的pdf-toolkit版本是在2006年發佈的,它看起來不像它已經被維護了。有一個1.0 release candidate 2012年2月發佈,你可以嘗試,但我不會建議依賴於生產用途的廢棄寶石。 github README說了以下內容:

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.

+0

感謝您的回答!我是Ruby on Rails的新手,但我不知道,現在問題已解決,但我有一個新問題:在此行中調用PDFTK時出錯:my_pdf = PDF :: Toolkit.open(path),任何想法?謝謝! – Anna

+1

@Anna我建議打開一個新的堆棧溢出問題併發布整個堆棧跟蹤。某人以這種方式評論和幫助你會更容易。 –

+0

添加到您的gemfile:gem「pdf-toolkit」,「〜> 1.0.0.rc1」 – Danny

相關問題