Paperclip/docsplit "has_attached_file" 无法识别

Paperclip/docsplit "has_attached_file" not reconized

我想将 docx 文件转换为 pdf。我发现这个 gem : https://github.com/tienle/docsplit-paperclip-processor

但是当我将示例中的代码放入我的控制器时出现错误

undefined method 'has_attached_file' for #<CvsController:0x83c3cb8>

我安装了回形针(我已经使用它在数据库中保存图像,当我这样做时它会出现在列表中bundle list) 我安装了 docsplit 和 filemagic。

我将此代码放入我的控制器(带有我的 docx 文件的路径):

has_attached_file :file, :default_url => "#{Rails.root}/#{@cvmodif.nom}.docx",
                  :style => {
                     :pdf => {
                          :format => "pdf",
                          :processors => [:docsplit_pdf]
                      }
                  }

你知道问题出在哪里吗?

你犯了一个错误。仔细阅读文档。 您可以将代码从控制器移动到模型 (!)。