Have your custom Paperclip Processors gone missing?

I’ve been converting a Rails 2.3.8 app into a Rails 3 app and one snafu was figuring out what happened to Paperclip. I use it to actually post-process audio files after upload, in this case slowing them down. I was getting this error:

uninitialized constant Paperclip::SlowerAudioFile:

Which is weird because I checked the readme and it still says to put them in the lib/paperclip_processors. I moved things around, I tried a bunch of little changes to the processor code, but nothing.

It seems the larger problem is just that the lib directory wasn’t being automatically loaded at all. (Turns out someone blogged this.) But by the time I had read that I had already taken the advice of a StackOverflow conversation and had just moved my processor to config/initializers/paperclip/slower_audio_file.rb, the beginning of the code looking like:

module Paperclip
  class SlowerAudioFile < Processor
    def initialize file, options = {}, attachment = nil
      ...
    end
    ...
  end
end

Leave a Reply