简体   繁体   中英

Paperclip/docsplit “has_attached_file” not reconized

I want to convert a docx file to pdf. I find this gem : https://github.com/tienle/docsplit-paperclip-processor

But when i put the code in the example in my controller I have an error

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

I have paperclip installed (I already use it in order to save an image in database and it appear in the list when I do bundle list ) I have docsplit installed and I have filemagic installed.

I put this code in my controller (with the path of my docx file) :

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

Do you know what is the problem?

You made ​​a mistake. Read the documentation carefully. You can move your code from controller to model(!).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM