Théo Capdet
Théo Capdet

Reputation: 1062

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?

Upvotes: 0

Views: 71

Answers (1)

Ruslan Kornienko
Ruslan Kornienko

Reputation: 261

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

Upvotes: 1

Related Questions