I have paperclip processors in the lib directory. Everytime I make a change to them, I am required to restart. I've tried the following in the /config/application.rb but none work. When I didn't have paperclip processors, the 3rd one worked so that I didn't have to restart my server everytime. Now, I have to restart everytime. 0Any suggestions on how to reload processors on request?
These are the 3 I've tried:
config.autoload_paths += "#{Rails.root}/lib"
config.eager_load_paths += ["#{Rails.root}/lib"]
config.autoload_paths << Rails.root.join('lib')
Just in case, in my model I have the line:
has_attached_file :mls_pdf, :styles => { :mls_pdf_processor => {:text_for => 'subject'} },
:path => "#{Rails.root}/storage/:class/:attachment/:id_partition/:style/:filename",
:url => "#{Rails.root}/storage/:class/:attachment/:id_partition/:style/:filename",
processors: [:mls_pdf_processor]
my processors in lib/paperclip_processors/mls_pdf_processor.rb
module Paperclip
class MlsPdfProcessor < Processor
require 'paperclip_processors/processor_helper.rb'
# include PaperclipProcessors::ProcessorHelper
def initialize( file, options = {}, attachment = nil )
super
@file = file
@attachment = attachment
@mls_type = options[:text_for]
@current_format = File.extname(@file.path)
@basename = File.basename(@file.path, '.*')
@dst_file = Tempfile.new([@basename, 'txt'])
@receiver = PDF::Reader::RegisterReceiver.new
@text = [] # all text data from PDF
@type # type of pdf
end
def make
@file
File.open(@dst_file)
end
end
end
Aucun commentaire:
Enregistrer un commentaire